| 505 | } |
| 506 | |
| 507 | HRESULT BrowserWindow::HandleTabURIUpdate(size_t tabId, ICoreWebView2* webview) |
| 508 | { |
| 509 | wil::unique_cotaskmem_string source; |
| 510 | RETURN_IF_FAILED(webview->get_Source(&source)); |
| 511 | |
| 512 | web::json::value jsonObj = web::json::value::parse(L"{}"); |
| 513 | jsonObj[L"message"] = web::json::value(MG_UPDATE_URI); |
| 514 | jsonObj[L"args"] = web::json::value::parse(L"{}"); |
| 515 | jsonObj[L"args"][L"tabId"] = web::json::value::number(tabId); |
| 516 | jsonObj[L"args"][L"uri"] = web::json::value(source.get()); |
| 517 | |
| 518 | std::wstring uri(source.get()); |
| 519 | std::wstring favoritesURI = GetFilePathAsURI(GetFullPathFor(L"wvbrowser_ui\\content_ui\\favorites.html")); |
| 520 | std::wstring settingsURI = GetFilePathAsURI(GetFullPathFor(L"wvbrowser_ui\\content_ui\\settings.html")); |
| 521 | std::wstring historyURI = GetFilePathAsURI(GetFullPathFor(L"wvbrowser_ui\\content_ui\\history.html")); |
| 522 | |
| 523 | if (uri.compare(favoritesURI) == 0) |
| 524 | { |
| 525 | jsonObj[L"args"][L"uriToShow"] = web::json::value(L"browser://favorites"); |
| 526 | } |
| 527 | else if (uri.compare(settingsURI) == 0) |
| 528 | { |
| 529 | jsonObj[L"args"][L"uriToShow"] = web::json::value(L"browser://settings"); |
| 530 | } |
| 531 | else if (uri.compare(historyURI) == 0) |
| 532 | { |
| 533 | jsonObj[L"args"][L"uriToShow"] = web::json::value(L"browser://history"); |
| 534 | } |
| 535 | |
| 536 | RETURN_IF_FAILED(PostJsonToWebView(jsonObj, m_controlsWebView.Get())); |
| 537 | |
| 538 | return S_OK; |
| 539 | } |
| 540 | |
| 541 | HRESULT BrowserWindow::HandleTabHistoryUpdate(size_t tabId, ICoreWebView2* webview) |
| 542 | { |