| 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/options/chromeos/change_picture_options_handle
r.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/change_picture_options_handle
r.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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 void ChangePictureOptionsHandler::HandleSelectImage(const ListValue* args) { | 228 void ChangePictureOptionsHandler::HandleSelectImage(const ListValue* args) { |
| 229 std::string image_url; | 229 std::string image_url; |
| 230 if (!args || | 230 if (!args || |
| 231 args->GetSize() != 1 || | 231 args->GetSize() != 1 || |
| 232 !args->GetString(0, &image_url)) { | 232 !args->GetString(0, &image_url)) { |
| 233 NOTREACHED(); | 233 NOTREACHED(); |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 if (image_url.empty()) | 236 DCHECK(!image_url.empty()); |
| 237 return; | |
| 238 | 237 |
| 239 UserManager* user_manager = UserManager::Get(); | 238 UserManager* user_manager = UserManager::Get(); |
| 240 const User& user = user_manager->logged_in_user(); | 239 const User& user = user_manager->logged_in_user(); |
| 241 int image_index = User::kInvalidImageIndex; | 240 int image_index = User::kInvalidImageIndex; |
| 242 | 241 |
| 243 if (StartsWithASCII(image_url, chrome::kChromeUIUserImageURL, false)) { | 242 if (StartsWithASCII(image_url, chrome::kChromeUIUserImageURL, false)) { |
| 244 // Image from file/camera uses kChromeUIUserImageURL as URL while | 243 // Image from file/camera uses kChromeUIUserImageURL as URL while |
| 245 // current profile image always has a full data URL. | 244 // current profile image always has a full data URL. |
| 246 // This way transition from (current profile image) to | 245 // This way transition from (current profile image) to |
| 247 // (profile image, current image from file) is easier. | 246 // (profile image, current image from file) is easier. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 327 |
| 329 gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const { | 328 gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const { |
| 330 Browser* browser = | 329 Browser* browser = |
| 331 BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_)); | 330 BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_)); |
| 332 if (!browser) | 331 if (!browser) |
| 333 return NULL; | 332 return NULL; |
| 334 return browser->window()->GetNativeHandle(); | 333 return browser->window()->GetNativeHandle(); |
| 335 } | 334 } |
| 336 | 335 |
| 337 } // namespace chromeos | 336 } // namespace chromeos |
| OLD | NEW |