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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc

Issue 10850036: [cros] Add attribution (author & website) strings to stock user images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 4 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
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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("profilePhoto", 64 localized_strings->SetString("profilePhoto",
65 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_PHOTO)); 65 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_PHOTO));
66 localized_strings->SetString("profilePhotoLoading", 66 localized_strings->SetString("profilePhotoLoading",
67 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO)); 67 l10n_util::GetStringUTF16(IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO));
68 localized_strings->SetString("okButtonText", 68 localized_strings->SetString("okButtonText",
69 l10n_util::GetStringUTF16(IDS_OK)); 69 l10n_util::GetStringUTF16(IDS_OK));
70 localized_strings->SetString("authorCredit",
71 l10n_util::GetStringUTF16(IDS_OPTIONS_SET_WALLPAPER_AUTHOR_TEXT));
70 if (!CommandLine::ForCurrentProcess()-> 72 if (!CommandLine::ForCurrentProcess()->
71 HasSwitch(switches::kDisableHtml5Camera)) { 73 HasSwitch(switches::kDisableHtml5Camera)) {
72 localized_strings->SetString("cameraType", "webrtc"); 74 localized_strings->SetString("cameraType", "webrtc");
73 } else { 75 } else {
74 localized_strings->SetString("cameraType", "old"); 76 localized_strings->SetString("cameraType", "old");
75 } 77 }
76 } 78 }
77 79
78 void UserImageScreenHandler::Initialize() { 80 void UserImageScreenHandler::Initialize() {
79 ListValue image_urls; 81 base::ListValue image_urls;
80 for (int i = kFirstDefaultImageIndex; i < kDefaultImagesCount; ++i) { 82 for (int i = kFirstDefaultImageIndex; i < kDefaultImagesCount; ++i) {
81 image_urls.Append(new StringValue(GetDefaultImageUrl(i))); 83 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue);
84 image_data->SetString("url", GetDefaultImageUrl(i));
85 image_data->SetString(
86 "author", l10n_util::GetStringUTF16(kDefaultImageAuthorIDs[i]));
87 image_data->SetString(
88 "website", l10n_util::GetStringUTF16(kDefaultImageWebsiteIDs[i]));
89 image_urls.Append(image_data.release());
82 } 90 }
83 web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setUserImages", 91 web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setDefaultImages",
84 image_urls); 92 image_urls);
85 93
86 if (selected_image_ != User::kInvalidImageIndex) 94 if (selected_image_ != User::kInvalidImageIndex)
87 SelectImage(selected_image_); 95 SelectImage(selected_image_);
88 96
89 if (profile_picture_data_url_ != chrome::kAboutBlankURL) 97 if (profile_picture_data_url_ != chrome::kAboutBlankURL)
90 SendProfileImage(profile_picture_data_url_); 98 SendProfileImage(profile_picture_data_url_);
91 else if (profile_picture_absent_) 99 else if (profile_picture_absent_)
92 OnProfileImageAbsent(); 100 OnProfileImageAbsent();
93 101
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 user_photo_ = gfx::ImageSkia(decoded_image); 301 user_photo_ = gfx::ImageSkia(decoded_image);
294 if (screen_ && accept_photo_after_decoding_) 302 if (screen_ && accept_photo_after_decoding_)
295 screen_->OnPhotoTaken(user_photo_); 303 screen_->OnPhotoTaken(user_photo_);
296 } 304 }
297 305
298 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) { 306 void UserImageScreenHandler::OnDecodeImageFailed(const ImageDecoder* decoder) {
299 NOTREACHED() << "Failed to decode PNG image from WebUI"; 307 NOTREACHED() << "Failed to decode PNG image from WebUI";
300 } 308 }
301 309
302 } // namespace chromeos 310 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698