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

Side by Side Diff: chrome/browser/chromeos/login/login_web_dialog.cc

Issue 10254027: chromeos: Rename LoginHtmlDialog to LoginWebDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/chromeos/login/login_html_dialog.h" 5 #include "chrome/browser/chromeos/login/login_web_dialog.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/chromeos/login/helper.h" 8 #include "chrome/browser/chromeos/login/helper.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/views/web_dialog_view.h" 10 #include "chrome/browser/ui/views/web_dialog_view.h"
11 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
12 #include "content/public/browser/notification_types.h" 12 #include "content/public/browser/notification_types.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 using content::WebUIMessageHandler; 19 using content::WebUIMessageHandler;
20 20
21 namespace chromeos { 21 namespace chromeos {
22 22
23 namespace { 23 namespace {
24 24
25 // Default width/height ratio of screen size. 25 // Default width/height ratio of screen size.
26 const double kDefaultWidthRatio = 0.6; 26 const double kDefaultWidthRatio = 0.6;
27 const double kDefaultHeightRatio = 0.6; 27 const double kDefaultHeightRatio = 0.6;
28 28
29 } // namespace 29 } // namespace
30 30
31 /////////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////////
32 // LoginHtmlDialog, public: 32 // LoginWebDialog, public:
33 33
34 void LoginHtmlDialog::Delegate::OnDialogClosed() { 34 void LoginWebDialog::Delegate::OnDialogClosed() {
35 } 35 }
36 36
37 LoginHtmlDialog::LoginHtmlDialog(Delegate* delegate, 37 LoginWebDialog::LoginWebDialog(Delegate* delegate,
38 gfx::NativeWindow parent_window, 38 gfx::NativeWindow parent_window,
39 const std::wstring& title, 39 const std::wstring& title,
40 const GURL& url, 40 const GURL& url,
41 Style style) 41 Style style)
42 : delegate_(delegate), 42 : delegate_(delegate),
43 parent_window_(parent_window), 43 parent_window_(parent_window),
44 title_(WideToUTF16Hack(title)), 44 title_(WideToUTF16Hack(title)),
45 url_(url), 45 url_(url),
46 style_(style), 46 style_(style),
47 bubble_frame_view_(NULL), 47 bubble_frame_view_(NULL),
48 is_open_(false) { 48 is_open_(false) {
49 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); 49 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size()));
50 width_ = static_cast<int>(kDefaultWidthRatio * screen_bounds.width()); 50 width_ = static_cast<int>(kDefaultWidthRatio * screen_bounds.width());
51 height_ = static_cast<int>(kDefaultHeightRatio * screen_bounds.height()); 51 height_ = static_cast<int>(kDefaultHeightRatio * screen_bounds.height());
52 } 52 }
53 53
54 LoginHtmlDialog::~LoginHtmlDialog() { 54 LoginWebDialog::~LoginWebDialog() {
55 delegate_ = NULL; 55 delegate_ = NULL;
56 } 56 }
57 57
58 void LoginHtmlDialog::Show() { 58 void LoginWebDialog::Show() {
59 views::Widget::CreateWindowWithParent( 59 views::Widget::CreateWindowWithParent(
60 new WebDialogView(ProfileManager::GetDefaultProfile(), NULL, this), 60 new WebDialogView(ProfileManager::GetDefaultProfile(), NULL, this),
61 parent_window_)->Show(); 61 parent_window_)->Show();
62 is_open_ = true; 62 is_open_ = true;
63 } 63 }
64 64
65 void LoginHtmlDialog::SetDialogSize(int width, int height) { 65 void LoginWebDialog::SetDialogSize(int width, int height) {
66 DCHECK(width >= 0 && height >= 0); 66 DCHECK(width >= 0 && height >= 0);
67 width_ = width; 67 width_ = width;
68 height_ = height; 68 height_ = height;
69 } 69 }
70 70
71 void LoginHtmlDialog::SetDialogTitle(const string16& title) { 71 void LoginWebDialog::SetDialogTitle(const string16& title) {
72 title_ = title; 72 title_ = title;
73 } 73 }
74 74
75 /////////////////////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////////////
76 // LoginHtmlDialog, protected: 76 // LoginWebDialog, protected:
77 77
78 ui::ModalType LoginHtmlDialog::GetDialogModalType() const { 78 ui::ModalType LoginWebDialog::GetDialogModalType() const {
79 return ui::MODAL_TYPE_SYSTEM; 79 return ui::MODAL_TYPE_SYSTEM;
80 } 80 }
81 81
82 string16 LoginHtmlDialog::GetDialogTitle() const { 82 string16 LoginWebDialog::GetDialogTitle() const {
83 return title_; 83 return title_;
84 } 84 }
85 85
86 GURL LoginHtmlDialog::GetDialogContentURL() const { 86 GURL LoginWebDialog::GetDialogContentURL() const {
87 return url_; 87 return url_;
88 } 88 }
89 89
90 void LoginHtmlDialog::GetWebUIMessageHandlers( 90 void LoginWebDialog::GetWebUIMessageHandlers(
91 std::vector<WebUIMessageHandler*>* handlers) const { 91 std::vector<WebUIMessageHandler*>* handlers) const {
92 } 92 }
93 93
94 void LoginHtmlDialog::GetDialogSize(gfx::Size* size) const { 94 void LoginWebDialog::GetDialogSize(gfx::Size* size) const {
95 size->SetSize(width_, height_); 95 size->SetSize(width_, height_);
96 } 96 }
97 97
98 std::string LoginHtmlDialog::GetDialogArgs() const { 98 std::string LoginWebDialog::GetDialogArgs() const {
99 return std::string(); 99 return std::string();
100 } 100 }
101 101
102 void LoginHtmlDialog::OnDialogClosed(const std::string& json_retval) { 102 void LoginWebDialog::OnDialogClosed(const std::string& json_retval) {
103 is_open_ = false; 103 is_open_ = false;
104 notification_registrar_.RemoveAll(); 104 notification_registrar_.RemoveAll();
105 if (delegate_) 105 if (delegate_)
106 delegate_->OnDialogClosed(); 106 delegate_->OnDialogClosed();
107 } 107 }
108 108
109 void LoginHtmlDialog::OnCloseContents(WebContents* source, 109 void LoginWebDialog::OnCloseContents(WebContents* source,
110 bool* out_close_dialog) { 110 bool* out_close_dialog) {
111 if (out_close_dialog) 111 if (out_close_dialog)
112 *out_close_dialog = true; 112 *out_close_dialog = true;
113 } 113 }
114 114
115 bool LoginHtmlDialog::ShouldShowDialogTitle() const { 115 bool LoginWebDialog::ShouldShowDialogTitle() const {
116 return true; 116 return true;
117 } 117 }
118 118
119 bool LoginHtmlDialog::HandleContextMenu( 119 bool LoginWebDialog::HandleContextMenu(
120 const content::ContextMenuParams& params) { 120 const content::ContextMenuParams& params) {
121 // Disable context menu. 121 // Disable context menu.
122 return true; 122 return true;
123 } 123 }
124 124
125 void LoginHtmlDialog::Observe(int type, 125 void LoginWebDialog::Observe(int type,
126 const content::NotificationSource& source, 126 const content::NotificationSource& source,
127 const content::NotificationDetails& details) { 127 const content::NotificationDetails& details) {
128 DCHECK(type == content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME); 128 DCHECK(type == content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME);
129 // TODO(saintlou): Do we need a throbber for Aura? 129 // TODO(saintlou): Do we need a throbber for Aura?
130 NOTIMPLEMENTED(); 130 NOTIMPLEMENTED();
131 } 131 }
132 132
133 } // namespace chromeos 133 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_web_dialog.h ('k') | chrome/browser/chromeos/login/proxy_settings_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698