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

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_ui.h" 11 #include "ui/web_dialogs/web_dialog_ui.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 #include "ui/views/controls/webview/webview.h" 14 #include "ui/views/controls/webview/webview.h"
15 #include "ui/views/view.h" 15 #include "ui/views/view.h"
16 #include "ui/views/widget/widget_delegate.h" 16 #include "ui/views/widget/widget_delegate.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 19
20 namespace { 20 namespace {
21 21
22 class ConstrainedWebDialogDelegateViews 22 class ConstrainedWebDialogDelegateViews
23 : public ConstrainedWebDialogDelegateBase { 23 : public ConstrainedWebDialogDelegateBase {
24 public: 24 public:
25 ConstrainedWebDialogDelegateViews( 25 ConstrainedWebDialogDelegateViews(
26 Profile* profile, 26 Profile* profile,
27 WebDialogDelegate* delegate, 27 views::WebDialogDelegate* delegate,
28 WebDialogWebContentsDelegate* tab_delegate) 28 ChromeWebDialogWebContentsDelegate* tab_delegate)
29 : ConstrainedWebDialogDelegateBase(profile, delegate, tab_delegate) { 29 : ConstrainedWebDialogDelegateBase(profile, delegate, tab_delegate) {
30 WebContents* web_contents = tab()->web_contents(); 30 WebContents* web_contents = tab()->web_contents();
31 if (tab_delegate) { 31 if (tab_delegate) {
32 set_override_tab_delegate(tab_delegate); 32 set_override_tab_delegate(tab_delegate);
33 web_contents->SetDelegate(tab_delegate); 33 web_contents->SetDelegate(tab_delegate);
34 } else { 34 } else {
35 web_contents->SetDelegate(this); 35 web_contents->SetDelegate(this);
36 } 36 }
37 } 37 }
38 38
(...skipping 10 matching lines...) Expand all
49 49
50 } // namespace 50 } // namespace
51 51
52 class ConstrainedWebDialogDelegateViewViews 52 class ConstrainedWebDialogDelegateViewViews
53 : public views::WebView, 53 : public views::WebView,
54 public ConstrainedWebDialogDelegate, 54 public ConstrainedWebDialogDelegate,
55 public views::WidgetDelegate { 55 public views::WidgetDelegate {
56 public: 56 public:
57 ConstrainedWebDialogDelegateViewViews( 57 ConstrainedWebDialogDelegateViewViews(
58 Profile* profile, 58 Profile* profile,
59 WebDialogDelegate* delegate, 59 views::WebDialogDelegate* delegate,
60 WebDialogWebContentsDelegate* tab_delegate); 60 ChromeWebDialogWebContentsDelegate* tab_delegate);
61 virtual ~ConstrainedWebDialogDelegateViewViews(); 61 virtual ~ConstrainedWebDialogDelegateViewViews();
62 62
63 void set_window(ConstrainedWindow* window) { 63 void set_window(ConstrainedWindow* window) {
64 return impl_->set_window(window); 64 return impl_->set_window(window);
65 } 65 }
66 66
67 // ConstrainedWebDialogDelegate interface 67 // ConstrainedWebDialogDelegate interface
68 virtual const WebDialogDelegate* 68 virtual const views::WebDialogDelegate*
69 GetWebDialogDelegate() const OVERRIDE { 69 GetWebDialogDelegate() const OVERRIDE {
70 return impl_->GetWebDialogDelegate(); 70 return impl_->GetWebDialogDelegate();
71 } 71 }
72 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { 72 virtual views::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE {
73 return impl_->GetWebDialogDelegate(); 73 return impl_->GetWebDialogDelegate();
74 } 74 }
75 virtual void OnDialogCloseFromWebUI() OVERRIDE { 75 virtual void OnDialogCloseFromWebUI() OVERRIDE {
76 return impl_->OnDialogCloseFromWebUI(); 76 return impl_->OnDialogCloseFromWebUI();
77 } 77 }
78 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE { 78 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE {
79 return impl_->ReleaseTabContentsOnDialogClose(); 79 return impl_->ReleaseTabContentsOnDialogClose();
80 } 80 }
81 virtual ConstrainedWindow* window() OVERRIDE { 81 virtual ConstrainedWindow* window() OVERRIDE {
82 return impl_->window(); 82 return impl_->window();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 private: 117 private:
118 scoped_ptr<ConstrainedWebDialogDelegateViews> impl_; 118 scoped_ptr<ConstrainedWebDialogDelegateViews> impl_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewViews); 120 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewViews);
121 }; 121 };
122 122
123 ConstrainedWebDialogDelegateViewViews::ConstrainedWebDialogDelegateViewViews( 123 ConstrainedWebDialogDelegateViewViews::ConstrainedWebDialogDelegateViewViews(
124 Profile* profile, 124 Profile* profile,
125 WebDialogDelegate* delegate, 125 views::WebDialogDelegate* delegate,
126 WebDialogWebContentsDelegate* tab_delegate) 126 ChromeWebDialogWebContentsDelegate* tab_delegate)
127 : views::WebView(profile), 127 : views::WebView(profile),
128 impl_(new ConstrainedWebDialogDelegateViews(profile, 128 impl_(new ConstrainedWebDialogDelegateViews(profile,
129 delegate, 129 delegate,
130 tab_delegate)) { 130 tab_delegate)) {
131 SetWebContents(tab()->web_contents()); 131 SetWebContents(tab()->web_contents());
132 } 132 }
133 133
134 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews() { 134 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews() {
135 } 135 }
136 136
137 // static 137 // static
138 ConstrainedWebDialogDelegate* 138 ConstrainedWebDialogDelegate*
139 ConstrainedWebDialogUI::CreateConstrainedWebDialog( 139 ConstrainedWebDialogUI::CreateConstrainedWebDialog(
140 Profile* profile, 140 Profile* profile,
141 WebDialogDelegate* delegate, 141 views::WebDialogDelegate* delegate,
142 WebDialogWebContentsDelegate* tab_delegate, 142 ChromeWebDialogWebContentsDelegate* tab_delegate,
143 TabContentsWrapper* container) { 143 TabContentsWrapper* container) {
144 ConstrainedWebDialogDelegateViewViews* constrained_delegate = 144 ConstrainedWebDialogDelegateViewViews* constrained_delegate =
145 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate) ; 145 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate) ;
146 ConstrainedWindow* constrained_window = 146 ConstrainedWindow* constrained_window =
147 new ConstrainedWindowViews(container, constrained_delegate); 147 new ConstrainedWindowViews(container, constrained_delegate);
148 constrained_delegate->set_window(constrained_window); 148 constrained_delegate->set_window(constrained_window);
149 return constrained_delegate; 149 return constrained_delegate;
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698