| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/webview/web_dialog_view.h" | 5 #include "ui/views/controls/webview/web_dialog_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 void WebDialogView::BeforeUnloadFired(content::WebContents* tab, | 328 void WebDialogView::BeforeUnloadFired(content::WebContents* tab, |
| 329 bool proceed, | 329 bool proceed, |
| 330 bool* proceed_to_fire_unload) { | 330 bool* proceed_to_fire_unload) { |
| 331 before_unload_fired_ = true; | 331 before_unload_fired_ = true; |
| 332 *proceed_to_fire_unload = proceed; | 332 *proceed_to_fire_unload = proceed; |
| 333 } | 333 } |
| 334 | 334 |
| 335 bool WebDialogView::ShouldCreateWebContents( | 335 bool WebDialogView::ShouldCreateWebContents( |
| 336 content::WebContents* web_contents, | 336 content::WebContents* web_contents, |
| 337 content::SiteInstance* source_site_instance, |
| 337 int32_t route_id, | 338 int32_t route_id, |
| 338 int32_t main_frame_route_id, | 339 int32_t main_frame_route_id, |
| 339 int32_t main_frame_widget_route_id, | 340 int32_t main_frame_widget_route_id, |
| 340 WindowContainerType window_container_type, | 341 WindowContainerType window_container_type, |
| 342 const GURL& opener_url, |
| 341 const std::string& frame_name, | 343 const std::string& frame_name, |
| 342 const GURL& target_url, | 344 const GURL& target_url, |
| 343 const std::string& partition_id, | 345 const std::string& partition_id, |
| 344 content::SessionStorageNamespace* session_storage_namespace) { | 346 content::SessionStorageNamespace* session_storage_namespace) { |
| 345 if (delegate_) | 347 if (delegate_) |
| 346 return delegate_->HandleShouldCreateWebContents(); | 348 return delegate_->HandleShouldCreateWebContents(); |
| 347 return true; | 349 return true; |
| 348 } | 350 } |
| 349 | 351 |
| 350 //////////////////////////////////////////////////////////////////////////////// | 352 //////////////////////////////////////////////////////////////////////////////// |
| 351 // WebDialogView, private: | 353 // WebDialogView, private: |
| 352 | 354 |
| 353 void WebDialogView::InitDialog() { | 355 void WebDialogView::InitDialog() { |
| 354 content::WebContents* web_contents = web_view_->GetWebContents(); | 356 content::WebContents* web_contents = web_view_->GetWebContents(); |
| 355 if (web_contents->GetDelegate() == this) | 357 if (web_contents->GetDelegate() == this) |
| 356 return; | 358 return; |
| 357 | 359 |
| 358 web_contents->SetDelegate(this); | 360 web_contents->SetDelegate(this); |
| 359 | 361 |
| 360 // Set the delegate. This must be done before loading the page. See | 362 // Set the delegate. This must be done before loading the page. See |
| 361 // the comment above WebDialogUI in its header file for why. | 363 // the comment above WebDialogUI in its header file for why. |
| 362 WebDialogUI::SetDelegate(web_contents, this); | 364 WebDialogUI::SetDelegate(web_contents, this); |
| 363 | 365 |
| 364 web_view_->LoadInitialURL(GetDialogContentURL()); | 366 web_view_->LoadInitialURL(GetDialogContentURL()); |
| 365 } | 367 } |
| 366 | 368 |
| 367 } // namespace views | 369 } // namespace views |
| OLD | NEW |