| 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 "chrome/browser/ui/views/web_dialog_view.h" | 5 #include "chrome/browser/ui/views/web_dialog_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "ui/aura/event.h" | 28 #include "ui/aura/event.h" |
| 29 #include "ui/views/widget/native_widget_aura.h" | 29 #include "ui/views/widget/native_widget_aura.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 using content::NativeWebKeyboardEvent; | 32 using content::NativeWebKeyboardEvent; |
| 33 using content::WebContents; | 33 using content::WebContents; |
| 34 using content::WebUIMessageHandler; | 34 using content::WebUIMessageHandler; |
| 35 using ui::WebDialogDelegate; | 35 using ui::WebDialogDelegate; |
| 36 using ui::WebDialogUI; | 36 using ui::WebDialogUI; |
| 37 | 37 |
| 38 namespace browser { | 38 namespace chrome { |
| 39 | 39 |
| 40 // Declared in browser_dialogs.h so that others don't need to depend on our .h. | 40 // Declared in browser_dialogs.h so that others don't need to depend on our .h. |
| 41 gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent, | 41 gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent, |
| 42 content::BrowserContext* context, | 42 content::BrowserContext* context, |
| 43 WebDialogDelegate* delegate) { | 43 WebDialogDelegate* delegate) { |
| 44 views::Widget* widget = views::Widget::CreateWindowWithParent( | 44 views::Widget* widget = views::Widget::CreateWindowWithParent( |
| 45 new WebDialogView(context, delegate), parent); | 45 new WebDialogView(context, delegate), parent); |
| 46 widget->Show(); | 46 widget->Show(); |
| 47 return widget->GetNativeWindow(); | 47 return widget->GetNativeWindow(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace browser | 50 } // namespace chrome |
| 51 | 51 |
| 52 //////////////////////////////////////////////////////////////////////////////// | 52 //////////////////////////////////////////////////////////////////////////////// |
| 53 // WebDialogView, public: | 53 // WebDialogView, public: |
| 54 | 54 |
| 55 WebDialogView::WebDialogView(content::BrowserContext* context, | 55 WebDialogView::WebDialogView(content::BrowserContext* context, |
| 56 WebDialogDelegate* delegate) | 56 WebDialogDelegate* delegate) |
| 57 : ClientView(NULL, NULL), | 57 : ClientView(NULL, NULL), |
| 58 WebDialogWebContentsDelegate(context), | 58 WebDialogWebContentsDelegate(context), |
| 59 initialized_(false), | 59 initialized_(false), |
| 60 delegate_(delegate), | 60 delegate_(delegate), |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 if (delegate_) { | 324 if (delegate_) { |
| 325 gfx::Size out; | 325 gfx::Size out; |
| 326 delegate_->GetDialogSize(&out); | 326 delegate_->GetDialogSize(&out); |
| 327 if (!out.IsEmpty() && GetWidget()) | 327 if (!out.IsEmpty() && GetWidget()) |
| 328 GetWidget()->CenterWindow(out); | 328 GetWidget()->CenterWindow(out); |
| 329 } | 329 } |
| 330 | 330 |
| 331 web_view_->LoadInitialURL(GetDialogContentURL()); | 331 web_view_->LoadInitialURL(GetDialogContentURL()); |
| 332 } | 332 } |
| OLD | NEW |