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

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

Issue 7851008: Crash fix for the case when the default profile is nuked while UI still expects it around. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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/chromeos/login/webui_login_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) 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 "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/accessibility_util.h" 10 #include "chrome/browser/chromeos/accessibility_util.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 namespace chromeos { 95 namespace chromeos {
96 96
97 // static 97 // static
98 const int WebUILoginView::kStatusAreaCornerPadding = 5; 98 const int WebUILoginView::kStatusAreaCornerPadding = 5;
99 99
100 // WebUILoginView public: ------------------------------------------------------ 100 // WebUILoginView public: ------------------------------------------------------
101 101
102 WebUILoginView::WebUILoginView() 102 WebUILoginView::WebUILoginView()
103 : status_area_(NULL), 103 : status_area_(NULL),
104 profile_(NULL),
105 webui_login_(NULL), 104 webui_login_(NULL),
106 status_window_(NULL), 105 status_window_(NULL),
107 host_window_frozen_(false), 106 host_window_frozen_(false),
108 status_area_visibility_on_init_(true) { 107 status_area_visibility_on_init_(true) {
109 #if defined(TOUCH_UI) 108 #if defined(TOUCH_UI)
110 // Make sure the singleton KeyboardManager object is created. 109 // Make sure the singleton KeyboardManager object is created.
111 KeyboardManager::GetInstance(); 110 KeyboardManager::GetInstance();
112 #endif 111 #endif
113 accel_map_[views::Accelerator(ui::VKEY_Z, false, true, true)] = 112 accel_map_[views::Accelerator(ui::VKEY_Z, false, true, true)] =
114 kAccelNameAccessibility; 113 kAccelNameAccessibility;
115 accel_map_[views::Accelerator(ui::VKEY_E, false, true, true)] = 114 accel_map_[views::Accelerator(ui::VKEY_E, false, true, true)] =
116 kAccelNameEnrollment; 115 kAccelNameEnrollment;
117 116
118 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) 117 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i)
119 AddAccelerator(i->first); 118 AddAccelerator(i->first);
120 } 119 }
121 120
122 WebUILoginView::~WebUILoginView() { 121 WebUILoginView::~WebUILoginView() {
123 if (status_window_) 122 if (status_window_)
124 status_window_->Close(); 123 status_window_->Close();
125 status_window_ = NULL; 124 status_window_ = NULL;
126 } 125 }
127 126
128 void WebUILoginView::Init() { 127 void WebUILoginView::Init() {
129 profile_ = ProfileManager::GetDefaultProfile();
130 128
131 webui_login_ = new DOMView(); 129 webui_login_ = new DOMView();
132 AddChildView(webui_login_); 130 AddChildView(webui_login_);
133 webui_login_->Init(profile_, NULL); 131 webui_login_->Init(ProfileManager::GetDefaultProfile(), NULL);
134 webui_login_->SetVisible(true); 132 webui_login_->SetVisible(true);
135 webui_login_->tab_contents()->set_delegate(this); 133 webui_login_->tab_contents()->set_delegate(this);
136 134
137 tab_watcher_.reset(new TabFirstRenderWatcher(webui_login_->tab_contents(), 135 tab_watcher_.reset(new TabFirstRenderWatcher(webui_login_->tab_contents(),
138 this)); 136 this));
139 } 137 }
140 138
141 std::string WebUILoginView::GetClassName() const { 139 std::string WebUILoginView::GetClassName() const {
142 return kViewClassName; 140 return kViewClassName;
143 } 141 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 DCHECK(webui_login_); 204 DCHECK(webui_login_);
207 webui_login_->SetBoundsRect(bounds()); 205 webui_login_->SetBoundsRect(bounds());
208 } 206 }
209 207
210 void WebUILoginView::ChildPreferredSizeChanged(View* child) { 208 void WebUILoginView::ChildPreferredSizeChanged(View* child) {
211 Layout(); 209 Layout();
212 SchedulePaint(); 210 SchedulePaint();
213 } 211 }
214 212
215 Profile* WebUILoginView::GetProfile() const { 213 Profile* WebUILoginView::GetProfile() const {
216 return profile_; 214 return ProfileManager::GetDefaultProfile();
xiyuan 2011/09/08 02:12:36 Let's return NULL here. As this is an implementati
217 } 215 }
218 216
219 void WebUILoginView::ExecuteBrowserCommand(int id) const { 217 void WebUILoginView::ExecuteBrowserCommand(int id) const {
220 } 218 }
221 219
222 bool WebUILoginView::ShouldOpenButtonOptions( 220 bool WebUILoginView::ShouldOpenButtonOptions(
223 const views::View* button_view) const { 221 const views::View* button_view) const {
224 if (button_view == status_area_->network_view()) 222 if (button_view == status_area_->network_view())
225 return true; 223 return true;
226 224
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 GetFocusManager()); 351 GetFocusManager());
354 352
355 // Make sure error bubble is cleared on keyboard event. This is needed 353 // Make sure error bubble is cleared on keyboard event. This is needed
356 // when the focus is inside an iframe. 354 // when the focus is inside an iframe.
357 WebUI* web_ui = GetWebUI(); 355 WebUI* web_ui = GetWebUI();
358 if (web_ui) 356 if (web_ui)
359 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); 357 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors");
360 } 358 }
361 359
362 } // namespace chromeos 360 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698