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