Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1149)

Unified Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 2662503002: Convert StartPageService and ZoomController to use the new navigation callbacks. (Closed)
Patch Set: fix unittest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | chrome/browser/ui/zoom/zoom_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index f61f7926c0c3c244c8ad054349e449965b1a8bd5..c27634647f990296666805768b7a9cf726a3d8f3 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -40,6 +40,7 @@
#include "components/search_engines/template_url_service.h"
#include "components/zoom/zoom_controller.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -557,12 +558,24 @@ void StartPageService::Shutdown() {
network_change_observer_.reset();
}
-void StartPageService::DidNavigateMainFrame(
- const content::LoadCommittedDetails& /*details*/,
- const content::FrameNavigateParams& /*params*/) {
- // Set the zoom level in DidNavigateMainFrame, as this is the earliest point
+void StartPageService::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
Dan Beam 2017/01/27 20:33:21 should this !IsInMainFrame() be after the error ch
jam 2017/01/27 21:28:57 per the other comment, these two methods realy onl
+ return;
+
+ if (navigation_handle->IsErrorPage()) {
+ // This avoids displaying a "Webpage Blocked" error or similar (which can
+ // happen if the URL is blacklisted by enterprise policy).
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&StartPageService::UnloadContents,
+ weak_factory_.GetWeakPtr()));
+ return;
+ }
+
+ // Set the zoom level in DidFinishNavigation, as this is the earliest point
// at which it can be done and not be affected by the ZoomController's
- // DidNavigateMainFrame handler.
+ // DidFinishNavigation handler.
//
// Use a temporary zoom level for this web contents (aka isolated zoom
// mode) so changes to its zoom aren't reflected in any preferences.
@@ -573,19 +586,6 @@ void StartPageService::DidNavigateMainFrame(
zoom::ZoomController::FromWebContents(contents_.get())->SetZoomLevel(0);
}
-void StartPageService::DidFailProvisionalLoad(
Dan Beam 2017/01/27 20:33:21 did this only apply to the main page? did this ge
jam 2017/01/27 21:28:57 The chrome apps page has no frames, so the IsInMai
- content::RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- int error_code,
- const base::string16& error_description,
- bool was_ignored_by_handler) {
- // This avoids displaying a "Webpage Blocked" error or similar (which can
- // happen if the URL is blacklisted by enterprise policy).
- content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
- base::Bind(&StartPageService::UnloadContents,
- weak_factory_.GetWeakPtr()));
-}
-
void StartPageService::WebUILoaded() {
// There's a race condition between the WebUI loading, and calling its JS
// functions. Specifically, calling LoadContents() doesn't mean that the page
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | chrome/browser/ui/zoom/zoom_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698