OLD | NEW |
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/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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void UserImageScreenHandler::GetLocalizedStrings( | 54 void UserImageScreenHandler::GetLocalizedStrings( |
55 DictionaryValue *localized_strings) { | 55 DictionaryValue *localized_strings) { |
56 // TODO(ivankr): string should be renamed to something like | 56 // TODO(ivankr): string should be renamed to something like |
57 // IDS_USER_IMAGE_SCREEN_TITLE (currently used for Take Photo dialog). | 57 // IDS_USER_IMAGE_SCREEN_TITLE (currently used for Take Photo dialog). |
58 localized_strings->SetString("userImageScreenTitle", | 58 localized_strings->SetString("userImageScreenTitle", |
59 l10n_util::GetStringUTF16(IDS_OOBE_PICTURE)); | 59 l10n_util::GetStringUTF16(IDS_OOBE_PICTURE)); |
60 localized_strings->SetString("userImageScreenDescription", | 60 localized_strings->SetString("userImageScreenDescription", |
61 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT)); | 61 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT)); |
62 localized_strings->SetString("takePhoto", | 62 localized_strings->SetString("takePhoto", |
63 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_TAKE_PHOTO)); | 63 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_TAKE_PHOTO)); |
| 64 localized_strings->SetString("discardPhoto", |
| 65 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DISCARD_PHOTO)); |
| 66 localized_strings->SetString("flipPhoto", |
| 67 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_FLIP_PHOTO)); |
64 localized_strings->SetString("profilePhoto", | 68 localized_strings->SetString("profilePhoto", |
65 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_PHOTO)); | 69 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_PHOTO)); |
66 localized_strings->SetString("profilePhotoLoading", | 70 localized_strings->SetString("profilePhotoLoading", |
67 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO)); | 71 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO)); |
68 localized_strings->SetString("okButtonText", | 72 localized_strings->SetString("okButtonText", |
69 l10n_util::GetStringUTF16(IDS_OK)); | 73 l10n_util::GetStringUTF16(IDS_OK)); |
70 localized_strings->SetString("authorCredit", | 74 localized_strings->SetString("authorCredit", |
71 l10n_util::GetStringUTF16(IDS_OPTIONS_SET_WALLPAPER_AUTHOR_TEXT)); | 75 l10n_util::GetStringUTF16(IDS_OPTIONS_SET_WALLPAPER_AUTHOR_TEXT)); |
72 if (!CommandLine::ForCurrentProcess()-> | 76 if (!CommandLine::ForCurrentProcess()-> |
73 HasSwitch(switches::kDisableHtml5Camera)) { | 77 HasSwitch(switches::kDisableHtml5Camera)) { |
74 localized_strings->SetString("cameraType", "webrtc"); | 78 localized_strings->SetString("cameraType", "webrtc"); |
75 } else { | 79 } else { |
76 localized_strings->SetString("cameraType", "old"); | 80 localized_strings->SetString("cameraType", "old"); |
77 } | 81 } |
78 } | 82 } |
79 | 83 |
80 void UserImageScreenHandler::Initialize() { | 84 void UserImageScreenHandler::Initialize() { |
81 base::ListValue image_urls; | 85 base::ListValue image_urls; |
82 for (int i = kFirstDefaultImageIndex; i < kDefaultImagesCount; ++i) { | 86 for (int i = kFirstDefaultImageIndex; i < kDefaultImagesCount; ++i) { |
83 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); | 87 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); |
84 image_data->SetString("url", GetDefaultImageUrl(i)); | 88 image_data->SetString("url", GetDefaultImageUrl(i)); |
85 image_data->SetString( | 89 image_data->SetString( |
86 "author", l10n_util::GetStringUTF16(kDefaultImageAuthorIDs[i])); | 90 "author", l10n_util::GetStringUTF16(kDefaultImageAuthorIDs[i])); |
87 image_data->SetString( | 91 image_data->SetString( |
88 "website", l10n_util::GetStringUTF16(kDefaultImageWebsiteIDs[i])); | 92 "website", l10n_util::GetStringUTF16(kDefaultImageWebsiteIDs[i])); |
| 93 image_data->SetString("title", GetDefaultImageDescription(i)); |
89 image_urls.Append(image_data.release()); | 94 image_urls.Append(image_data.release()); |
90 } | 95 } |
91 web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setDefaultImages", | 96 web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setDefaultImages", |
92 image_urls); | 97 image_urls); |
93 | 98 |
94 if (selected_image_ != User::kInvalidImageIndex) | 99 if (selected_image_ != User::kInvalidImageIndex) |
95 SelectImage(selected_image_); | 100 SelectImage(selected_image_); |
96 | 101 |
97 if (profile_picture_data_url_ != chrome::kAboutBlankURL) | 102 if (profile_picture_data_url_ != chrome::kAboutBlankURL) |
98 SendProfileImage(profile_picture_data_url_); | 103 SendProfileImage(profile_picture_data_url_); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 user_photo_ = gfx::ImageSkia(decoded_image); | 306 user_photo_ = gfx::ImageSkia(decoded_image); |
302 if (screen_ && accept_photo_after_decoding_) | 307 if (screen_ && accept_photo_after_decoding_) |
303 screen_->OnPhotoTaken(user_photo_); | 308 screen_->OnPhotoTaken(user_photo_); |
304 } | 309 } |
305 | 310 |
306 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) { | 311 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) { |
307 NOTREACHED() << "Failed to decode PNG image from WebUI"; | 312 NOTREACHED() << "Failed to decode PNG image from WebUI"; |
308 } | 313 } |
309 | 314 |
310 } // namespace chromeos | 315 } // namespace chromeos |
OLD | NEW |