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/ui/webui/chromeos/login/user_image_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 user_photo_ = photo; | 155 user_photo_ = photo; |
156 selected_image_ = UserManager::User::kExternalImageIndex; | 156 selected_image_ = UserManager::User::kExternalImageIndex; |
157 base::StringValue data_url(web_ui_util::GetImageDataUrl(user_photo_)); | 157 base::StringValue data_url(web_ui_util::GetImageDataUrl(user_photo_)); |
158 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto", | 158 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto", |
159 data_url); | 159 data_url); |
160 } | 160 } |
161 | 161 |
162 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) { | 162 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) { |
163 DCHECK(args && args->empty()); | 163 DCHECK(args && args->empty()); |
164 TakePhotoDialog* take_photo_dialog = new TakePhotoDialog(this); | 164 TakePhotoDialog* take_photo_dialog = new TakePhotoDialog(this); |
165 views::Widget* login_window = WebUILoginDisplay::GetLoginWindow(); | |
166 views::Widget* window = browser::CreateViewsWindow( | 165 views::Widget* window = browser::CreateViewsWindow( |
167 login_window->GetNativeWindow(), | 166 GetNativeWindow(), |
168 take_photo_dialog); | 167 take_photo_dialog); |
169 window->SetAlwaysOnTop(true); | 168 window->SetAlwaysOnTop(true); |
170 window->Show(); | 169 window->Show(); |
171 } | 170 } |
172 | 171 |
173 void UserImageScreenHandler::HandleSelectImage(const base::ListValue* args) { | 172 void UserImageScreenHandler::HandleSelectImage(const base::ListValue* args) { |
174 std::string image_url; | 173 std::string image_url; |
175 if (!args || | 174 if (!args || |
176 args->GetSize() != 1 || | 175 args->GetSize() != 1 || |
177 !args->GetString(0, &image_url)) { | 176 !args->GetString(0, &image_url)) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 210 } |
212 | 211 |
213 void UserImageScreenHandler::OnCameraPresenceCheckDone() { | 212 void UserImageScreenHandler::OnCameraPresenceCheckDone() { |
214 base::FundamentalValue present_value( | 213 base::FundamentalValue present_value( |
215 CameraDetector::camera_presence() == CameraDetector::kCameraPresent); | 214 CameraDetector::camera_presence() == CameraDetector::kCameraPresent); |
216 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent", | 215 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent", |
217 present_value); | 216 present_value); |
218 } | 217 } |
219 | 218 |
220 } // namespace chromeos | 219 } // namespace chromeos |
OLD | NEW |