| 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/property_bag.h" | |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
| 13 #include "content/public/browser/notification_details.h" | 12 #include "content/public/browser/notification_details.h" |
| 14 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
| 15 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
| 18 #include "ui/views/controls/webview/webview.h" | 17 #include "ui/views/controls/webview/webview.h" |
| 19 #include "ui/views/layout/fill_layout.h" | 18 #include "ui/views/layout/fill_layout.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 300 |
| 302 void WebDialogView::InitDialog() { | 301 void WebDialogView::InitDialog() { |
| 303 content::WebContents* web_contents = web_view_->GetWebContents(); | 302 content::WebContents* web_contents = web_view_->GetWebContents(); |
| 304 if (web_contents->GetDelegate() == this) | 303 if (web_contents->GetDelegate() == this) |
| 305 return; | 304 return; |
| 306 | 305 |
| 307 web_contents->SetDelegate(this); | 306 web_contents->SetDelegate(this); |
| 308 | 307 |
| 309 // Set the delegate. This must be done before loading the page. See | 308 // Set the delegate. This must be done before loading the page. See |
| 310 // the comment above WebDialogUI in its header file for why. | 309 // the comment above WebDialogUI in its header file for why. |
| 311 WebDialogUI::GetPropertyAccessor().SetProperty( | 310 WebDialogUI::SetDelegate(web_contents, this); |
| 312 web_contents->GetPropertyBag(), this); | |
| 313 | 311 |
| 314 if (delegate_) { | 312 if (delegate_) { |
| 315 gfx::Size out; | 313 gfx::Size out; |
| 316 delegate_->GetDialogSize(&out); | 314 delegate_->GetDialogSize(&out); |
| 317 if (!out.IsEmpty() && GetWidget()) | 315 if (!out.IsEmpty() && GetWidget()) |
| 318 GetWidget()->CenterWindow(out); | 316 GetWidget()->CenterWindow(out); |
| 319 } | 317 } |
| 320 | 318 |
| 321 web_view_->LoadInitialURL(GetDialogContentURL()); | 319 web_view_->LoadInitialURL(GetDialogContentURL()); |
| 322 } | 320 } |
| 323 | 321 |
| 324 } // namespace views | 322 } // namespace views |
| OLD | NEW |