OLD | NEW |
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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void RunCompletionCallback(bool success, | 151 void RunCompletionCallback(bool success, |
152 DriveFirstRunController::UMAOutcome outcome); | 152 DriveFirstRunController::UMAOutcome outcome); |
153 | 153 |
154 // content::WebContentsObserver overrides: | 154 // content::WebContentsObserver overrides: |
155 virtual void DidFailProvisionalLoad( | 155 virtual void DidFailProvisionalLoad( |
156 content::RenderFrameHost* render_frame_host, | 156 content::RenderFrameHost* render_frame_host, |
157 const GURL& validated_url, | 157 const GURL& validated_url, |
158 int error_code, | 158 int error_code, |
159 const base::string16& error_description) OVERRIDE; | 159 const base::string16& error_description) OVERRIDE; |
160 | 160 |
161 virtual void DidFailLoad(int64 frame_id, | 161 virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, |
162 const GURL& validated_url, | 162 const GURL& validated_url, |
163 bool is_main_frame, | |
164 int error_code, | 163 int error_code, |
165 const base::string16& error_description, | 164 const base::string16& error_description) OVERRIDE; |
166 content::RenderViewHost* render_view_host) OVERRIDE; | |
167 | 165 |
168 // content::WebContentsDelegate overrides: | 166 // content::WebContentsDelegate overrides: |
169 virtual bool ShouldCreateWebContents( | 167 virtual bool ShouldCreateWebContents( |
170 content::WebContents* web_contents, | 168 content::WebContents* web_contents, |
171 int route_id, | 169 int route_id, |
172 WindowContainerType window_container_type, | 170 WindowContainerType window_container_type, |
173 const base::string16& frame_name, | 171 const base::string16& frame_name, |
174 const GURL& target_url, | 172 const GURL& target_url, |
175 const std::string& partition_id, | 173 const std::string& partition_id, |
176 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; | 174 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 int error_code, | 259 int error_code, |
262 const base::string16& error_description) { | 260 const base::string16& error_description) { |
263 if (!render_frame_host->GetParent()) { | 261 if (!render_frame_host->GetParent()) { |
264 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; | 262 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; |
265 OnOfflineInit(false, | 263 OnOfflineInit(false, |
266 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); | 264 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); |
267 } | 265 } |
268 } | 266 } |
269 | 267 |
270 void DriveWebContentsManager::DidFailLoad( | 268 void DriveWebContentsManager::DidFailLoad( |
271 int64 frame_id, | 269 content::RenderFrameHost* render_frame_host, |
272 const GURL& validated_url, | 270 const GURL& validated_url, |
273 bool is_main_frame, | |
274 int error_code, | 271 int error_code, |
275 const base::string16& error_description, | 272 const base::string16& error_description) { |
276 content::RenderViewHost* render_view_host) { | 273 if (!render_frame_host->GetParent()) { |
277 if (is_main_frame) { | |
278 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; | 274 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; |
279 OnOfflineInit(false, | 275 OnOfflineInit(false, |
280 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); | 276 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); |
281 } | 277 } |
282 } | 278 } |
283 | 279 |
284 bool DriveWebContentsManager::ShouldCreateWebContents( | 280 bool DriveWebContentsManager::ShouldCreateWebContents( |
285 content::WebContents* web_contents, | 281 content::WebContents* web_contents, |
286 int route_id, | 282 int route_id, |
287 WindowContainerType window_container_type, | 283 WindowContainerType window_container_type, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 base::UTF8ToUTF16(extension->name()), | 470 base::UTF8ToUTF16(extension->name()), |
475 message_center::NotifierId(message_center::NotifierId::APPLICATION, | 471 message_center::NotifierId(message_center::NotifierId::APPLICATION, |
476 kDriveHostedAppId), | 472 kDriveHostedAppId), |
477 data, | 473 data, |
478 new DriveOfflineNotificationDelegate(profile_))); | 474 new DriveOfflineNotificationDelegate(profile_))); |
479 notification->set_priority(message_center::LOW_PRIORITY); | 475 notification->set_priority(message_center::LOW_PRIORITY); |
480 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 476 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
481 } | 477 } |
482 | 478 |
483 } // namespace chromeos | 479 } // namespace chromeos |
OLD | NEW |