| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/chromeos/login/camera_detector.h" | 12 #include "chrome/browser/chromeos/login/camera_detector.h" |
| 13 #include "chrome/browser/chromeos/login/default_user_images.h" | 13 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 14 #include "chrome/browser/chromeos/login/user.h" | 14 #include "chrome/browser/chromeos/login/user.h" |
| 15 #include "chrome/browser/chromeos/login/webui_login_display.h" | 15 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 16 #include "chrome/browser/chromeos/options/take_photo_dialog.h" | 16 #include "chrome/browser/chromeos/options/take_photo_dialog.h" |
| 17 #include "chrome/browser/ui/dialog_style.h" |
| 17 #include "chrome/browser/ui/views/window.h" | 18 #include "chrome/browser/ui/views/window.h" |
| 18 #include "chrome/browser/ui/webui/web_ui_util.h" | 19 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // UserImage screen ID. | 27 // UserImage screen ID. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 base::StringValue data_url(user_photo_data_url_); | 180 base::StringValue data_url(user_photo_data_url_); |
| 180 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto", | 181 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto", |
| 181 data_url); | 182 data_url); |
| 182 } | 183 } |
| 183 | 184 |
| 184 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) { | 185 void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) { |
| 185 DCHECK(args && args->empty()); | 186 DCHECK(args && args->empty()); |
| 186 TakePhotoDialog* take_photo_dialog = new TakePhotoDialog(this); | 187 TakePhotoDialog* take_photo_dialog = new TakePhotoDialog(this); |
| 187 views::Widget* window = browser::CreateViewsWindow( | 188 views::Widget* window = browser::CreateViewsWindow( |
| 188 GetNativeWindow(), | 189 GetNativeWindow(), |
| 189 take_photo_dialog); | 190 take_photo_dialog, |
| 191 STYLE_GENERIC); |
| 190 window->SetAlwaysOnTop(true); | 192 window->SetAlwaysOnTop(true); |
| 191 window->Show(); | 193 window->Show(); |
| 192 } | 194 } |
| 193 | 195 |
| 194 void UserImageScreenHandler::HandleSelectImage(const base::ListValue* args) { | 196 void UserImageScreenHandler::HandleSelectImage(const base::ListValue* args) { |
| 195 std::string image_url; | 197 std::string image_url; |
| 196 if (!args || | 198 if (!args || |
| 197 args->GetSize() != 1 || | 199 args->GetSize() != 1 || |
| 198 !args->GetString(0, &image_url)) { | 200 !args->GetString(0, &image_url)) { |
| 199 NOTREACHED(); | 201 NOTREACHED(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 243 } |
| 242 | 244 |
| 243 void UserImageScreenHandler::OnCameraPresenceCheckDone() { | 245 void UserImageScreenHandler::OnCameraPresenceCheckDone() { |
| 244 base::FundamentalValue present_value( | 246 base::FundamentalValue present_value( |
| 245 CameraDetector::camera_presence() == CameraDetector::kCameraPresent); | 247 CameraDetector::camera_presence() == CameraDetector::kCameraPresent); |
| 246 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent", | 248 web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent", |
| 247 present_value); | 249 present_value); |
| 248 } | 250 } |
| 249 | 251 |
| 250 } // namespace chromeos | 252 } // namespace chromeos |
| OLD | NEW |