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

Side by Side Diff: chrome/browser/views/html_dialog_view.cc

Issue 199069: Added an event handler to the GAIA login page which closes the dialog when it... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « chrome/browser/views/html_dialog_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/html_dialog_view.h" 5 #include "chrome/browser/views/html_dialog_view.h"
6 6
7 #include "base/keyboard_codes.h"
7 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "views/widget/root_view.h" 10 #include "views/widget/root_view.h"
10 #include "views/widget/widget.h" 11 #include "views/widget/widget.h"
11 #include "views/window/window.h" 12 #include "views/window/window.h"
12 13
13 namespace browser { 14 namespace browser {
14 15
15 // Declared in browser_dialogs.h so that others don't need to depend on our .h. 16 // Declared in browser_dialogs.h so that others don't need to depend on our .h.
16 void ShowHtmlDialogView(gfx::NativeWindow parent, Browser* browser, 17 void ShowHtmlDialogView(gfx::NativeWindow parent, Browser* browser,
(...skipping 24 matching lines...) Expand all
41 //////////////////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////////
42 // HtmlDialogView, views::View implementation: 43 // HtmlDialogView, views::View implementation:
43 44
44 gfx::Size HtmlDialogView::GetPreferredSize() { 45 gfx::Size HtmlDialogView::GetPreferredSize() {
45 gfx::Size out; 46 gfx::Size out;
46 if (delegate_) 47 if (delegate_)
47 delegate_->GetDialogSize(&out); 48 delegate_->GetDialogSize(&out);
48 return out; 49 return out;
49 } 50 }
50 51
52 bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) {
53 // Pressing ESC closes the dialog.
54 DCHECK_EQ(base::VKEY_ESCAPE, accelerator.GetKeyCode());
55 OnDialogClosed(std::string());
56 return true;
57 }
58
51 //////////////////////////////////////////////////////////////////////////////// 59 ////////////////////////////////////////////////////////////////////////////////
52 // HtmlDialogView, views::WindowDelegate implementation: 60 // HtmlDialogView, views::WindowDelegate implementation:
53 61
54 bool HtmlDialogView::CanResize() const { 62 bool HtmlDialogView::CanResize() const {
55 return true; 63 return true;
56 } 64 }
57 65
58 bool HtmlDialogView::IsModal() const { 66 bool HtmlDialogView::IsModal() const {
59 if (delegate_) 67 if (delegate_)
60 return delegate_->IsDialogModal(); 68 return delegate_->IsDialogModal();
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Now Init the DOMView. This view runs in its own process to render the html. 217 // Now Init the DOMView. This view runs in its own process to render the html.
210 DOMView::Init(profile_, NULL); 218 DOMView::Init(profile_, NULL);
211 219
212 tab_contents_->set_delegate(this); 220 tab_contents_->set_delegate(this);
213 221
214 // Set the delegate. This must be done before loading the page. See 222 // Set the delegate. This must be done before loading the page. See
215 // the comment above HtmlDialogUI in its header file for why. 223 // the comment above HtmlDialogUI in its header file for why.
216 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), 224 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(),
217 this); 225 this);
218 226
227 // Pressing the ESC key will close the dialog.
228 AddAccelerator(views::Accelerator(base::VKEY_ESCAPE, false, false, false));
229
219 DOMView::LoadURL(delegate_->GetDialogContentURL()); 230 DOMView::LoadURL(delegate_->GetDialogContentURL());
220 } 231 }
OLDNEW
« no previous file with comments | « chrome/browser/views/html_dialog_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698