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_) |
| 344 return delegate_->HandleShouldCreateWebContents(); |
| 345 return true; |
| 346 } |
| 347 |
334 //////////////////////////////////////////////////////////////////////////////// | 348 //////////////////////////////////////////////////////////////////////////////// |
335 // WebDialogView, private: | 349 // WebDialogView, private: |
336 | 350 |
337 void WebDialogView::InitDialog() { | 351 void WebDialogView::InitDialog() { |
338 content::WebContents* web_contents = web_view_->GetWebContents(); | 352 content::WebContents* web_contents = web_view_->GetWebContents(); |
339 if (web_contents->GetDelegate() == this) | 353 if (web_contents->GetDelegate() == this) |
340 return; | 354 return; |
341 | 355 |
342 web_contents->SetDelegate(this); | 356 web_contents->SetDelegate(this); |
343 | 357 |
344 // Set the delegate. This must be done before loading the page. See | 358 // Set the delegate. This must be done before loading the page. See |
345 // the comment above WebDialogUI in its header file for why. | 359 // the comment above WebDialogUI in its header file for why. |
346 WebDialogUI::SetDelegate(web_contents, this); | 360 WebDialogUI::SetDelegate(web_contents, this); |
347 | 361 |
348 web_view_->LoadInitialURL(GetDialogContentURL()); | 362 web_view_->LoadInitialURL(GetDialogContentURL()); |
349 } | 363 } |
350 | 364 |
351 } // namespace views | 365 } // namespace views |
OLD | NEW |