| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/chromeos/login/camera_detector.h" | 13 #include "chrome/browser/chromeos/login/camera_detector.h" |
| 14 #include "chrome/browser/chromeos/login/default_user_images.h" | 14 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 15 #include "chrome/browser/chromeos/login/user_manager.h" | 15 #include "chrome/browser/chromeos/login/user_manager.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/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/views/window.h" | 20 #include "chrome/browser/ui/views/window.h" |
| 21 #include "chrome/browser/ui/webui/web_ui_util.cc" | 21 #include "chrome/browser/ui/webui/web_ui_util.cc" |
| 22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/common/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 29 #include "third_party/skia/include/core/SkBitmap.h" | 29 #include "third_party/skia/include/core/SkBitmap.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "views/widget/widget.h" | 32 #include "views/widget/widget.h" |
| 33 | 33 |
| 34 namespace chromeos { | 34 namespace chromeos { |
| 35 | 35 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 return file_type_info; | 55 return file_type_info; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 ChangePictureOptionsHandler::ChangePictureOptionsHandler() | 60 ChangePictureOptionsHandler::ChangePictureOptionsHandler() |
| 61 : previous_image_data_url_(chrome::kAboutBlankURL), | 61 : previous_image_data_url_(chrome::kAboutBlankURL), |
| 62 profile_image_data_url_(chrome::kAboutBlankURL), | 62 profile_image_data_url_(chrome::kAboutBlankURL), |
| 63 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 63 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 64 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED, | 64 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED, |
| 65 NotificationService::AllSources()); | 65 content::NotificationService::AllSources()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ChangePictureOptionsHandler::~ChangePictureOptionsHandler() { | 68 ChangePictureOptionsHandler::~ChangePictureOptionsHandler() { |
| 69 if (select_file_dialog_.get()) | 69 if (select_file_dialog_.get()) |
| 70 select_file_dialog_->ListenerDestroyed(); | 70 select_file_dialog_->ListenerDestroyed(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ChangePictureOptionsHandler::Initialize() { | 73 void ChangePictureOptionsHandler::Initialize() { |
| 74 const UserManager::User& user = UserManager::Get()->logged_in_user(); | 74 const UserManager::User& user = UserManager::Get()->logged_in_user(); |
| 75 | 75 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const { | 360 gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const { |
| 361 Browser* browser = | 361 Browser* browser = |
| 362 BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_)); | 362 BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_)); |
| 363 if (!browser) | 363 if (!browser) |
| 364 return NULL; | 364 return NULL; |
| 365 return browser->window()->GetNativeHandle(); | 365 return browser->window()->GetNativeHandle(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace chromeos | 368 } // namespace chromeos |
| OLD | NEW |