| 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 int route_id, | 337 int32 route_id, |
| 338 int main_frame_route_id, | 338 int32 main_frame_route_id, |
| 339 int32 main_frame_widget_route_id, |
| 339 WindowContainerType window_container_type, | 340 WindowContainerType window_container_type, |
| 340 const std::string& frame_name, | 341 const std::string& frame_name, |
| 341 const GURL& target_url, | 342 const GURL& target_url, |
| 342 const std::string& partition_id, | 343 const std::string& partition_id, |
| 343 content::SessionStorageNamespace* session_storage_namespace) { | 344 content::SessionStorageNamespace* session_storage_namespace) { |
| 344 if (delegate_) | 345 if (delegate_) |
| 345 return delegate_->HandleShouldCreateWebContents(); | 346 return delegate_->HandleShouldCreateWebContents(); |
| 346 return true; | 347 return true; |
| 347 } | 348 } |
| 348 | 349 |
| 349 //////////////////////////////////////////////////////////////////////////////// | 350 //////////////////////////////////////////////////////////////////////////////// |
| 350 // WebDialogView, private: | 351 // WebDialogView, private: |
| 351 | 352 |
| 352 void WebDialogView::InitDialog() { | 353 void WebDialogView::InitDialog() { |
| 353 content::WebContents* web_contents = web_view_->GetWebContents(); | 354 content::WebContents* web_contents = web_view_->GetWebContents(); |
| 354 if (web_contents->GetDelegate() == this) | 355 if (web_contents->GetDelegate() == this) |
| 355 return; | 356 return; |
| 356 | 357 |
| 357 web_contents->SetDelegate(this); | 358 web_contents->SetDelegate(this); |
| 358 | 359 |
| 359 // Set the delegate. This must be done before loading the page. See | 360 // Set the delegate. This must be done before loading the page. See |
| 360 // the comment above WebDialogUI in its header file for why. | 361 // the comment above WebDialogUI in its header file for why. |
| 361 WebDialogUI::SetDelegate(web_contents, this); | 362 WebDialogUI::SetDelegate(web_contents, this); |
| 362 | 363 |
| 363 web_view_->LoadInitialURL(GetDialogContentURL()); | 364 web_view_->LoadInitialURL(GetDialogContentURL()); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace views | 367 } // namespace views |
| OLD | NEW |