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

Side by Side Diff: chrome/browser/chromeos/first_run/drive_first_run_controller.cc

Issue 2658203002: Convert DriveWebContentsManager to use the new navigation callbacks. (Closed)
Patch Set: a Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h" 5 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 24 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
25 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 26 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
27 #include "chrome/browser/ui/singleton_tabs.h" 27 #include "chrome/browser/ui/singleton_tabs.h"
28 #include "chrome/grit/generated_resources.h" 28 #include "chrome/grit/generated_resources.h"
29 #include "chrome/grit/theme_resources.h" 29 #include "chrome/grit/theme_resources.h"
30 #include "components/user_manager/user_manager.h" 30 #include "components/user_manager/user_manager.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/navigation_controller.h" 32 #include "content/public/browser/navigation_controller.h"
33 #include "content/public/browser/navigation_handle.h"
33 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
34 #include "content/public/browser/notification_observer.h" 35 #include "content/public/browser/notification_observer.h"
35 #include "content/public/browser/notification_registrar.h" 36 #include "content/public/browser/notification_registrar.h"
36 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/notification_types.h" 38 #include "content/public/browser/notification_types.h"
38 #include "content/public/browser/render_frame_host.h" 39 #include "content/public/browser/render_frame_host.h"
39 #include "content/public/browser/site_instance.h" 40 #include "content/public/browser/site_instance.h"
40 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
41 #include "content/public/browser/web_contents_observer.h" 42 #include "content/public/browser/web_contents_observer.h"
42 #include "extensions/browser/extension_registry.h" 43 #include "extensions/browser/extension_registry.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Called when when offline initialization succeeds or fails and schedules 144 // Called when when offline initialization succeeds or fails and schedules
144 // |RunCompletionCallback|. 145 // |RunCompletionCallback|.
145 void OnOfflineInit(bool success, 146 void OnOfflineInit(bool success,
146 DriveFirstRunController::UMAOutcome outcome); 147 DriveFirstRunController::UMAOutcome outcome);
147 148
148 // Runs |completion_callback|. 149 // Runs |completion_callback|.
149 void RunCompletionCallback(bool success, 150 void RunCompletionCallback(bool success,
150 DriveFirstRunController::UMAOutcome outcome); 151 DriveFirstRunController::UMAOutcome outcome);
151 152
152 // content::WebContentsObserver overrides: 153 // content::WebContentsObserver overrides:
153 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, 154 void DidFinishNavigation(
154 const GURL& validated_url, 155 content::NavigationHandle* navigation_handle) override;
155 int error_code,
156 const base::string16& error_description,
157 bool was_ignored_by_handler) override;
158 156
159 void DidFailLoad(content::RenderFrameHost* render_frame_host, 157 void DidFailLoad(content::RenderFrameHost* render_frame_host,
160 const GURL& validated_url, 158 const GURL& validated_url,
161 int error_code, 159 int error_code,
162 const base::string16& error_description, 160 const base::string16& error_description,
163 bool was_ignored_by_handler) override; 161 bool was_ignored_by_handler) override;
164 162
165 // content::WebContentsDelegate overrides: 163 // content::WebContentsDelegate overrides:
166 bool ShouldCreateWebContents( 164 bool ShouldCreateWebContents(
167 content::WebContents* web_contents, 165 content::WebContents* web_contents,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 StopLoad(); 245 StopLoad();
248 } 246 }
249 } 247 }
250 248
251 void DriveWebContentsManager::RunCompletionCallback( 249 void DriveWebContentsManager::RunCompletionCallback(
252 bool success, 250 bool success,
253 DriveFirstRunController::UMAOutcome outcome) { 251 DriveFirstRunController::UMAOutcome outcome) {
254 completion_callback_.Run(success, outcome); 252 completion_callback_.Run(success, outcome);
255 } 253 }
256 254
257 void DriveWebContentsManager::DidFailProvisionalLoad( 255 void DriveWebContentsManager::DidFinishNavigation(
258 content::RenderFrameHost* render_frame_host, 256 content::NavigationHandle* navigation_handle) {
259 const GURL& validated_url, 257 if (navigation_handle->IsInMainFrame() && navigation_handle->IsErrorPage()) {
260 int error_code,
261 const base::string16& error_description,
262 bool was_ignored_by_handler) {
263 if (!render_frame_host->GetParent()) {
264 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; 258 LOG(WARNING) << "Failed to load WebContents to enable offline mode.";
265 OnOfflineInit(false, 259 OnOfflineInit(false,
266 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); 260 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED);
267 } 261 }
268 } 262 }
269 263
270 void DriveWebContentsManager::DidFailLoad( 264 void DriveWebContentsManager::DidFailLoad(
271 content::RenderFrameHost* render_frame_host, 265 content::RenderFrameHost* render_frame_host,
272 const GURL& validated_url, 266 const GURL& validated_url,
273 int error_code, 267 int error_code,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 base::UTF8ToUTF16(extension->name()), GURL(), 469 base::UTF8ToUTF16(extension->name()), GURL(),
476 message_center::NotifierId(message_center::NotifierId::APPLICATION, 470 message_center::NotifierId(message_center::NotifierId::APPLICATION,
477 kDriveHostedAppId), 471 kDriveHostedAppId),
478 data, new DriveOfflineNotificationDelegate(profile_))); 472 data, new DriveOfflineNotificationDelegate(profile_)));
479 notification->set_priority(message_center::LOW_PRIORITY); 473 notification->set_priority(message_center::LOW_PRIORITY);
480 message_center::MessageCenter::Get()->AddNotification( 474 message_center::MessageCenter::Get()->AddNotification(
481 std::move(notification)); 475 std::move(notification));
482 } 476 }
483 477
484 } // namespace chromeos 478 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698