Chromium Code Reviews| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 delegate_->OnLoadingStateChanged(source); | 324 delegate_->OnLoadingStateChanged(source); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void WebDialogView::BeforeUnloadFired(content::WebContents* tab, | 327 void WebDialogView::BeforeUnloadFired(content::WebContents* tab, |
| 328 bool proceed, | 328 bool proceed, |
| 329 bool* proceed_to_fire_unload) { | 329 bool* proceed_to_fire_unload) { |
| 330 before_unload_fired_ = true; | 330 before_unload_fired_ = true; |
| 331 *proceed_to_fire_unload = proceed; | 331 *proceed_to_fire_unload = proceed; |
| 332 } | 332 } |
| 333 | 333 |
| 334 bool WebDialogView::ShouldCreateWebContents( | |
| 335 content::WebContents* web_contents, | |
| 336 int route_id, | |
| 337 int main_frame_route_id, | |
| 338 WindowContainerType window_container_type, | |
| 339 const base::string16& frame_name, | |
| 340 const GURL& target_url, | |
| 341 const std::string& partition_id, | |
| 342 content::SessionStorageNamespace* session_storage_namespace) { | |
| 343 if (delegate_ && !delegate_->HandleShouldCreateWebContents()) { | |
| 344 return false; | |
| 345 } | |
| 346 return true; | |
| 347 } | |
|
sadrul
2015/02/03 02:45:21
return delegate_ ? delegate_->HandleShouldCreateWe
Ivan Podogov
2015/02/03 08:09:08
I'm really into ternary operations as well, althou
| |
| 348 | |
| 334 //////////////////////////////////////////////////////////////////////////////// | 349 //////////////////////////////////////////////////////////////////////////////// |
| 335 // WebDialogView, private: | 350 // WebDialogView, private: |
| 336 | 351 |
| 337 void WebDialogView::InitDialog() { | 352 void WebDialogView::InitDialog() { |
| 338 content::WebContents* web_contents = web_view_->GetWebContents(); | 353 content::WebContents* web_contents = web_view_->GetWebContents(); |
| 339 if (web_contents->GetDelegate() == this) | 354 if (web_contents->GetDelegate() == this) |
| 340 return; | 355 return; |
| 341 | 356 |
| 342 web_contents->SetDelegate(this); | 357 web_contents->SetDelegate(this); |
| 343 | 358 |
| 344 // Set the delegate. This must be done before loading the page. See | 359 // Set the delegate. This must be done before loading the page. See |
| 345 // the comment above WebDialogUI in its header file for why. | 360 // the comment above WebDialogUI in its header file for why. |
| 346 WebDialogUI::SetDelegate(web_contents, this); | 361 WebDialogUI::SetDelegate(web_contents, this); |
| 347 | 362 |
| 348 web_view_->LoadInitialURL(GetDialogContentURL()); | 363 web_view_->LoadInitialURL(GetDialogContentURL()); |
| 349 } | 364 } |
| 350 | 365 |
| 351 } // namespace views | 366 } // namespace views |
| OLD | NEW |