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

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

Issue 11647017: Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: stage changes to preserve history Created 8 years 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/views/constrained_window_views.h" 8 #include "chrome/browser/ui/views/constrained_window_views.h"
9 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" 9 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 28 matching lines...) Expand all
39 web_contents->SetDelegate(tab_delegate); 39 web_contents->SetDelegate(tab_delegate);
40 } else { 40 } else {
41 web_contents->SetDelegate(this); 41 web_contents->SetDelegate(this);
42 } 42 }
43 } 43 }
44 44
45 virtual ~ConstrainedWebDialogDelegateViews() {} 45 virtual ~ConstrainedWebDialogDelegateViews() {}
46 46
47 // WebDialogWebContentsDelegate interface. 47 // WebDialogWebContentsDelegate interface.
48 virtual void CloseContents(WebContents* source) OVERRIDE { 48 virtual void CloseContents(WebContents* source) OVERRIDE {
49 GetWindow()->CloseConstrainedWindow(); 49 GetWindow()->CloseWebContentsModalDialog();
50 } 50 }
51 51
52 // contents::WebContentsDelegate 52 // contents::WebContentsDelegate
53 virtual void HandleKeyboardEvent( 53 virtual void HandleKeyboardEvent(
54 content::WebContents* source, 54 content::WebContents* source,
55 const content::NativeWebKeyboardEvent& event) OVERRIDE { 55 const content::NativeWebKeyboardEvent& event) OVERRIDE {
56 unhandled_keyboard_event_handler_.HandleKeyboardEvent( 56 unhandled_keyboard_event_handler_.HandleKeyboardEvent(
57 event, view_->GetFocusManager()); 57 event, view_->GetFocusManager());
58 } 58 }
59 59
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 GetWidget()->CenterWindow( 144 GetWidget()->CenterWindow(
145 GetWidget()->non_client_view()->GetPreferredSize()); 145 GetWidget()->non_client_view()->GetPreferredSize());
146 views::WidgetDelegate::OnWidgetMove(); 146 views::WidgetDelegate::OnWidgetMove();
147 } 147 }
148 148
149 // views::WebView overrides. 149 // views::WebView overrides.
150 virtual bool AcceleratorPressed( 150 virtual bool AcceleratorPressed(
151 const ui::Accelerator& accelerator) OVERRIDE { 151 const ui::Accelerator& accelerator) OVERRIDE {
152 // Pressing ESC closes the dialog. 152 // Pressing ESC closes the dialog.
153 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); 153 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code());
154 GetWindow()->CloseConstrainedWindow(); 154 GetWindow()->CloseWebContentsModalDialog();
155 return true; 155 return true;
156 } 156 }
157 virtual gfx::Size GetPreferredSize() OVERRIDE { 157 virtual gfx::Size GetPreferredSize() OVERRIDE {
158 gfx::Size size; 158 gfx::Size size;
159 if (!impl_->closed_via_webui()) 159 if (!impl_->closed_via_webui())
160 GetWebDialogDelegate()->GetDialogSize(&size); 160 GetWebDialogDelegate()->GetDialogSize(&size);
161 return size; 161 return size;
162 } 162 }
163 virtual gfx::Size GetMinimumSize() OVERRIDE { 163 virtual gfx::Size GetMinimumSize() OVERRIDE {
164 // Return an empty size so that we can be made smaller. 164 // Return an empty size so that we can be made smaller.
(...skipping 30 matching lines...) Expand all
195 WebDialogWebContentsDelegate* tab_delegate, 195 WebDialogWebContentsDelegate* tab_delegate,
196 content::WebContents* web_contents) { 196 content::WebContents* web_contents) {
197 ConstrainedWebDialogDelegateViewViews* constrained_delegate = 197 ConstrainedWebDialogDelegateViewViews* constrained_delegate =
198 new ConstrainedWebDialogDelegateViewViews( 198 new ConstrainedWebDialogDelegateViewViews(
199 browser_context, delegate, tab_delegate); 199 browser_context, delegate, tab_delegate);
200 ConstrainedWindow* constrained_window = 200 ConstrainedWindow* constrained_window =
201 new ConstrainedWindowViews(web_contents, constrained_delegate); 201 new ConstrainedWindowViews(web_contents, constrained_delegate);
202 constrained_delegate->set_window(constrained_window); 202 constrained_delegate->set_window(constrained_window);
203 return constrained_delegate; 203 return constrained_delegate;
204 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | chrome/browser/ui/views/constrained_window_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698