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 <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 156 |
157 void DidFailLoad(content::RenderFrameHost* render_frame_host, | 157 void DidFailLoad(content::RenderFrameHost* render_frame_host, |
158 const GURL& validated_url, | 158 const GURL& validated_url, |
159 int error_code, | 159 int error_code, |
160 const base::string16& error_description, | 160 const base::string16& error_description, |
161 bool was_ignored_by_handler) override; | 161 bool was_ignored_by_handler) override; |
162 | 162 |
163 // content::WebContentsDelegate overrides: | 163 // content::WebContentsDelegate overrides: |
164 bool ShouldCreateWebContents( | 164 bool ShouldCreateWebContents( |
165 content::WebContents* web_contents, | 165 content::WebContents* web_contents, |
166 content::RenderFrameHost* opener, | |
166 content::SiteInstance* source_site_instance, | 167 content::SiteInstance* source_site_instance, |
167 int32_t route_id, | 168 int32_t route_id, |
168 int32_t main_frame_route_id, | 169 int32_t main_frame_route_id, |
169 int32_t main_frame_widget_route_id, | 170 int32_t main_frame_widget_route_id, |
170 content::mojom::WindowContainerType window_container_type, | 171 content::mojom::WindowContainerType window_container_type, |
171 const GURL& opener_url, | 172 const GURL& opener_url, |
172 const std::string& frame_name, | 173 const std::string& frame_name, |
173 const GURL& target_url, | 174 const GURL& target_url, |
174 const std::string& partition_id, | 175 const std::string& partition_id, |
175 content::SessionStorageNamespace* session_storage_namespace) override; | 176 content::SessionStorageNamespace* session_storage_namespace) override; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 bool was_ignored_by_handler) { | 270 bool was_ignored_by_handler) { |
270 if (!render_frame_host->GetParent()) { | 271 if (!render_frame_host->GetParent()) { |
271 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; | 272 LOG(WARNING) << "Failed to load WebContents to enable offline mode."; |
272 OnOfflineInit(false, | 273 OnOfflineInit(false, |
273 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); | 274 DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); |
274 } | 275 } |
275 } | 276 } |
276 | 277 |
277 bool DriveWebContentsManager::ShouldCreateWebContents( | 278 bool DriveWebContentsManager::ShouldCreateWebContents( |
278 content::WebContents* web_contents, | 279 content::WebContents* web_contents, |
280 content::RenderFrameHost* opener, | |
279 content::SiteInstance* source_site_instance, | 281 content::SiteInstance* source_site_instance, |
280 int32_t route_id, | 282 int32_t route_id, |
281 int32_t main_frame_route_id, | 283 int32_t main_frame_route_id, |
282 int32_t main_frame_widget_route_id, | 284 int32_t main_frame_widget_route_id, |
283 content::mojom::WindowContainerType window_container_type, | 285 content::mojom::WindowContainerType window_container_type, |
284 const GURL& opener_url, | 286 const GURL& opener_url, |
285 const std::string& frame_name, | 287 const std::string& frame_name, |
286 const GURL& target_url, | 288 const GURL& target_url, |
287 const std::string& partition_id, | 289 const std::string& partition_id, |
288 content::SessionStorageNamespace* session_storage_namespace) { | 290 content::SessionStorageNamespace* session_storage_namespace) { |
(...skipping 14 matching lines...) Expand all Loading... | |
303 | 305 |
304 // Prevent redirection if background contents already exists. | 306 // Prevent redirection if background contents already exists. |
305 if (background_contents_service->GetAppBackgroundContents( | 307 if (background_contents_service->GetAppBackgroundContents( |
306 base::UTF8ToUTF16(app_id_))) { | 308 base::UTF8ToUTF16(app_id_))) { |
307 return false; | 309 return false; |
308 } | 310 } |
309 // We are creating a new SiteInstance (and thus a new renderer process) here, | 311 // We are creating a new SiteInstance (and thus a new renderer process) here, |
310 // so we must not use |route_id|, etc, which are IDs in a different process. | 312 // so we must not use |route_id|, etc, which are IDs in a different process. |
311 BackgroundContents* contents = | 313 BackgroundContents* contents = |
312 background_contents_service->CreateBackgroundContents( | 314 background_contents_service->CreateBackgroundContents( |
313 content::SiteInstance::Create(profile_), MSG_ROUTING_NONE, | 315 content::SiteInstance::Create(profile_), nullptr, MSG_ROUTING_NONE, |
Andrew T Wilson (Slow)
2017/06/05 08:32:46
I'm not sure why we are passing in nullptr here in
Łukasz Anforowicz
2017/06/05 16:57:56
Good point - this is not that obvious what is goin
| |
314 MSG_ROUTING_NONE, MSG_ROUTING_NONE, profile_, frame_name, | 316 MSG_ROUTING_NONE, MSG_ROUTING_NONE, profile_, frame_name, |
315 base::ASCIIToUTF16(app_id_), partition_id, session_storage_namespace); | 317 base::ASCIIToUTF16(app_id_), partition_id, session_storage_namespace); |
316 | 318 |
317 contents->web_contents()->GetController().LoadURL( | 319 contents->web_contents()->GetController().LoadURL( |
318 target_url, | 320 target_url, |
319 content::Referrer(), | 321 content::Referrer(), |
320 ui::PAGE_TRANSITION_LINK, | 322 ui::PAGE_TRANSITION_LINK, |
321 std::string()); | 323 std::string()); |
322 | 324 |
323 // Return false as we already created the WebContents here. | 325 // Return false as we already created the WebContents here. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 base::UTF8ToUTF16(extension->name()), GURL(), | 471 base::UTF8ToUTF16(extension->name()), GURL(), |
470 message_center::NotifierId(message_center::NotifierId::APPLICATION, | 472 message_center::NotifierId(message_center::NotifierId::APPLICATION, |
471 kDriveHostedAppId), | 473 kDriveHostedAppId), |
472 data, new DriveOfflineNotificationDelegate(profile_))); | 474 data, new DriveOfflineNotificationDelegate(profile_))); |
473 notification->set_priority(message_center::LOW_PRIORITY); | 475 notification->set_priority(message_center::LOW_PRIORITY); |
474 message_center::MessageCenter::Get()->AddNotification( | 476 message_center::MessageCenter::Get()->AddNotification( |
475 std::move(notification)); | 477 std::move(notification)); |
476 } | 478 } |
477 | 479 |
478 } // namespace chromeos | 480 } // namespace chromeos |
OLD | NEW |