Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc

Issue 10353007: Extract a minimal subset of WebDialogUI/WebDialogDelegate from src/chrome -> src/ui/web_dialogs Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/webui/constrained_web_dialog_delegate_base.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
9 #include "chrome/browser/ui/views/constrained_window_views.h" 9 #include "chrome/browser/ui/views/constrained_window_views.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 11 #include "ui/web_dialogs/web_dialog_delegate.h"
12 #include "chrome/browser/ui/webui/web_dialog_ui.h" 12 #include "ui/web_dialogs/web_dialog_ui.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/views/controls/webview/webview.h" 15 #include "ui/views/controls/webview/webview.h"
16 #include "ui/views/view.h" 16 #include "ui/views/view.h"
17 #include "ui/views/widget/widget_delegate.h" 17 #include "ui/views/widget/widget_delegate.h"
18 18
19 using content::WebContents; 19 using content::WebContents;
20 20
21 namespace { 21 namespace {
22 22
23 class ConstrainedWebDialogDelegateViews 23 class ConstrainedWebDialogDelegateViews
24 : public ConstrainedWebDialogDelegateBase { 24 : public ConstrainedWebDialogDelegateBase {
25 public: 25 public:
26 ConstrainedWebDialogDelegateViews( 26 ConstrainedWebDialogDelegateViews(
27 Profile* profile, 27 Profile* profile,
28 WebDialogDelegate* delegate, 28 web_dialogs::WebDialogDelegate* delegate,
29 WebDialogWebContentsDelegate* tab_delegate) 29 ChromeWebDialogWebContentsDelegate* tab_delegate)
30 : ConstrainedWebDialogDelegateBase(profile, delegate, tab_delegate) { 30 : ConstrainedWebDialogDelegateBase(profile, delegate, tab_delegate) {
31 WebContents* web_contents = tab()->web_contents(); 31 WebContents* web_contents = tab()->web_contents();
32 if (tab_delegate) { 32 if (tab_delegate) {
33 set_override_tab_delegate(tab_delegate); 33 set_override_tab_delegate(tab_delegate);
34 web_contents->SetDelegate(tab_delegate); 34 web_contents->SetDelegate(tab_delegate);
35 } else { 35 } else {
36 web_contents->SetDelegate(this); 36 web_contents->SetDelegate(this);
37 } 37 }
38 } 38 }
39 39
(...skipping 10 matching lines...) Expand all
50 50
51 } // namespace 51 } // namespace
52 52
53 class ConstrainedWebDialogDelegateViewViews 53 class ConstrainedWebDialogDelegateViewViews
54 : public views::WebView, 54 : public views::WebView,
55 public ConstrainedWebDialogDelegate, 55 public ConstrainedWebDialogDelegate,
56 public views::WidgetDelegate { 56 public views::WidgetDelegate {
57 public: 57 public:
58 ConstrainedWebDialogDelegateViewViews( 58 ConstrainedWebDialogDelegateViewViews(
59 Profile* profile, 59 Profile* profile,
60 WebDialogDelegate* delegate, 60 web_dialogs::WebDialogDelegate* delegate,
61 WebDialogWebContentsDelegate* tab_delegate); 61 ChromeWebDialogWebContentsDelegate* tab_delegate);
62 virtual ~ConstrainedWebDialogDelegateViewViews(); 62 virtual ~ConstrainedWebDialogDelegateViewViews();
63 63
64 void set_window(ConstrainedWindow* window) { 64 void set_window(ConstrainedWindow* window) {
65 return impl_->set_window(window); 65 return impl_->set_window(window);
66 } 66 }
67 67
68 // ConstrainedWebDialogDelegate interface 68 // ConstrainedWebDialogDelegate interface
69 virtual const WebDialogDelegate* 69 virtual const web_dialogs::WebDialogDelegate*
70 GetWebDialogDelegate() const OVERRIDE { 70 GetWebDialogDelegate() const OVERRIDE {
71 return impl_->GetWebDialogDelegate(); 71 return impl_->GetWebDialogDelegate();
72 } 72 }
73 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { 73 virtual web_dialogs::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE {
74 return impl_->GetWebDialogDelegate(); 74 return impl_->GetWebDialogDelegate();
75 } 75 }
76 virtual void OnDialogCloseFromWebUI() OVERRIDE { 76 virtual void OnDialogCloseFromWebUI() OVERRIDE {
77 return impl_->OnDialogCloseFromWebUI(); 77 return impl_->OnDialogCloseFromWebUI();
78 } 78 }
79 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE { 79 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE {
80 return impl_->ReleaseTabContentsOnDialogClose(); 80 return impl_->ReleaseTabContentsOnDialogClose();
81 } 81 }
82 virtual ConstrainedWindow* window() OVERRIDE { 82 virtual ConstrainedWindow* window() OVERRIDE {
83 return impl_->window(); 83 return impl_->window();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 private: 118 private:
119 scoped_ptr<ConstrainedWebDialogDelegateViews> impl_; 119 scoped_ptr<ConstrainedWebDialogDelegateViews> impl_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewViews); 121 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewViews);
122 }; 122 };
123 123
124 ConstrainedWebDialogDelegateViewViews::ConstrainedWebDialogDelegateViewViews( 124 ConstrainedWebDialogDelegateViewViews::ConstrainedWebDialogDelegateViewViews(
125 Profile* profile, 125 Profile* profile,
126 WebDialogDelegate* delegate, 126 web_dialogs::WebDialogDelegate* delegate,
127 WebDialogWebContentsDelegate* tab_delegate) 127 ChromeWebDialogWebContentsDelegate* tab_delegate)
128 : views::WebView(profile), 128 : views::WebView(profile),
129 impl_(new ConstrainedWebDialogDelegateViews(profile, 129 impl_(new ConstrainedWebDialogDelegateViews(profile,
130 delegate, 130 delegate,
131 tab_delegate)) { 131 tab_delegate)) {
132 SetWebContents(tab()->web_contents()); 132 SetWebContents(tab()->web_contents());
133 } 133 }
134 134
135 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews() { 135 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews() {
136 } 136 }
137 137
138 // static 138 // static
139 ConstrainedWebDialogDelegate* 139 ConstrainedWebDialogDelegate*
140 ConstrainedWebDialogUI::CreateConstrainedWebDialog( 140 ConstrainedWebDialogUI::CreateConstrainedWebDialog(
141 Profile* profile, 141 Profile* profile,
142 WebDialogDelegate* delegate, 142 web_dialogs::WebDialogDelegate* delegate,
143 WebDialogWebContentsDelegate* tab_delegate, 143 ChromeWebDialogWebContentsDelegate* tab_delegate,
144 TabContentsWrapper* container) { 144 TabContentsWrapper* container) {
145 ConstrainedWebDialogDelegateViewViews* constrained_delegate = 145 ConstrainedWebDialogDelegateViewViews* constrained_delegate =
146 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate) ; 146 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate) ;
147 ConstrainedWindow* constrained_window = 147 ConstrainedWindow* constrained_window =
148 new ConstrainedWindowViews(container, constrained_delegate); 148 new ConstrainedWindowViews(container, constrained_delegate);
149 constrained_delegate->set_window(constrained_window); 149 constrained_delegate->set_window(constrained_window);
150 return constrained_delegate; 150 return constrained_delegate;
151 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698