| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/webui_login_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" | 7 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" |
| 8 #include "chrome/browser/chromeos/status/clock_menu_button.h" | 8 #include "chrome/browser/chromeos/status/clock_menu_button.h" |
| 9 #include "chrome/browser/chromeos/status/input_method_menu_button.h" | 9 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
| 10 #include "chrome/browser/chromeos/status/network_menu_button.h" | 10 #include "chrome/browser/chromeos/status/network_menu_button.h" |
| 11 #include "chrome/browser/chromeos/status/status_area_view.h" | 11 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 12 #include "chrome/browser/chromeos/wm_ipc.h" | 12 #include "chrome/browser/chromeos/wm_ipc.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/ui/views/dom_view.h" | 14 #include "chrome/browser/ui/views/dom_view.h" |
| 15 #include "content/browser/tab_contents/tab_contents.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 const char kViewClassName[] = "browser/chromeos/login/WebUILoginView"; | 19 const char kViewClassName[] = "browser/chromeos/login/WebUILoginView"; |
| 19 | 20 |
| 20 } // namespace | 21 } // namespace |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 24 // WebUILoginView public: ------------------------------------------------------ | 25 // WebUILoginView public: ------------------------------------------------------ |
| 25 | 26 |
| 26 WebUILoginView::WebUILoginView() | 27 WebUILoginView::WebUILoginView() |
| 27 : profile_(NULL), | 28 : profile_(NULL), |
| 28 status_area_(NULL), | 29 status_area_(NULL), |
| 29 webui_login_(NULL) { | 30 webui_login_(NULL) { |
| 30 } | 31 } |
| 31 | 32 |
| 32 WebUILoginView::~WebUILoginView() { | 33 WebUILoginView::~WebUILoginView() { |
| 33 } | 34 } |
| 34 | 35 |
| 35 void WebUILoginView::Init(const GURL& login_url) { | 36 void WebUILoginView::Init() { |
| 36 CHECK(!login_url.is_empty()); | |
| 37 | |
| 38 profile_ = ProfileManager::GetDefaultProfile(); | 37 profile_ = ProfileManager::GetDefaultProfile(); |
| 39 | 38 |
| 40 webui_login_ = new DOMView(); | 39 webui_login_ = new DOMView(); |
| 41 AddChildView(webui_login_); | 40 AddChildView(webui_login_); |
| 42 webui_login_->Init(profile_, NULL); | 41 webui_login_->Init(profile_, NULL); |
| 43 webui_login_->LoadURL(login_url); | |
| 44 webui_login_->SetVisible(true); | 42 webui_login_->SetVisible(true); |
| 45 | 43 |
| 46 InitStatusArea(); | 44 InitStatusArea(); |
| 47 } | 45 } |
| 48 | 46 |
| 49 | 47 |
| 50 std::string WebUILoginView::GetClassName() const { | 48 std::string WebUILoginView::GetClassName() const { |
| 51 return kViewClassName; | 49 return kViewClassName; |
| 52 } | 50 } |
| 53 | 51 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 } | 63 } |
| 66 | 64 |
| 67 void WebUILoginView::UpdateWindowType() { | 65 void WebUILoginView::UpdateWindowType() { |
| 68 std::vector<int> params; | 66 std::vector<int> params; |
| 69 WmIpc::instance()->SetWindowType( | 67 WmIpc::instance()->SetWindowType( |
| 70 GTK_WIDGET(GetNativeWindow()), | 68 GTK_WIDGET(GetNativeWindow()), |
| 71 WM_IPC_WINDOW_LOGIN_WEBUI, | 69 WM_IPC_WINDOW_LOGIN_WEBUI, |
| 72 ¶ms); | 70 ¶ms); |
| 73 } | 71 } |
| 74 | 72 |
| 73 void WebUILoginView::LoadURL(const GURL & url) { |
| 74 webui_login_->LoadURL(url); |
| 75 } |
| 76 |
| 77 WebUI* WebUILoginView::GetWebUI() { |
| 78 return webui_login_->tab_contents()->web_ui(); |
| 79 } |
| 80 |
| 75 // WebUILoginView protected: --------------------------------------------------- | 81 // WebUILoginView protected: --------------------------------------------------- |
| 76 | 82 |
| 77 void WebUILoginView::Layout() { | 83 void WebUILoginView::Layout() { |
| 78 DCHECK(webui_login_); | 84 DCHECK(webui_login_); |
| 79 DCHECK(status_area_); | 85 DCHECK(status_area_); |
| 80 | 86 |
| 81 // Layout the Status Area up in the right corner. This should always be done. | 87 // Layout the Status Area up in the right corner. This should always be done. |
| 82 const int kCornerPadding = 5; | 88 const int kCornerPadding = 5; |
| 83 gfx::Size status_area_size = status_area_->GetPreferredSize(); | 89 gfx::Size status_area_size = status_area_->GetPreferredSize(); |
| 84 status_area_->SetBounds( | 90 status_area_->SetBounds( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // WebUILoginView private: ----------------------------------------------------- | 142 // WebUILoginView private: ----------------------------------------------------- |
| 137 | 143 |
| 138 void WebUILoginView::InitStatusArea() { | 144 void WebUILoginView::InitStatusArea() { |
| 139 DCHECK(status_area_ == NULL); | 145 DCHECK(status_area_ == NULL); |
| 140 status_area_ = new StatusAreaView(this); | 146 status_area_ = new StatusAreaView(this); |
| 141 status_area_->Init(); | 147 status_area_->Init(); |
| 142 AddChildView(status_area_); | 148 AddChildView(status_area_); |
| 143 } | 149 } |
| 144 | 150 |
| 145 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |