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/chromeos/extensions/wallpaper_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/window_cycle_controller.h" | 10 #include "ash/wm/window_cycle_controller.h" |
11 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/synchronization/cancellation_flag.h" | 17 #include "base/synchronization/cancellation_flag.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
19 #include "base/threading/worker_pool.h" | 19 #include "base/threading/worker_pool.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chromeos/login/user.h" | 21 #include "chrome/browser/chromeos/login/user.h" |
22 #include "chrome/browser/chromeos/login/user_image.h" | 22 #include "chrome/browser/chromeos/login/user_image.h" |
23 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
24 #include "chrome/browser/chromeos/login/wallpaper_manager.h" | 24 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
25 #include "chrome/browser/extensions/event_router.h" | 25 #include "chrome/browser/extensions/event_router.h" |
26 #include "chrome/browser/image_decoder.h" | 26 #include "chrome/browser/image_decoder.h" |
27 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 27 #include "chrome/browser/ui/webui/web_ui_util.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "net/url_request/url_fetcher.h" | 30 #include "net/url_request/url_fetcher.h" |
31 #include "net/url_request/url_fetcher_delegate.h" | 31 #include "net/url_request/url_fetcher_delegate.h" |
32 #include "net/url_request/url_request_status.h" | 32 #include "net/url_request/url_request_status.h" |
33 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
35 #include "grit/platform_locale_settings.h" | 35 #include "grit/platform_locale_settings.h" |
36 #include "ui/aura/window_observer.h" | 36 #include "ui/aura/window_observer.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 SET_STRING("connectionFailed", IDS_WALLPAPER_MANAGER_ACCESS_FAIL); | 200 SET_STRING("connectionFailed", IDS_WALLPAPER_MANAGER_ACCESS_FAIL); |
201 SET_STRING("downloadFailed", IDS_WALLPAPER_MANAGER_DOWNLOAD_FAIL); | 201 SET_STRING("downloadFailed", IDS_WALLPAPER_MANAGER_DOWNLOAD_FAIL); |
202 SET_STRING("downloadCanceled", IDS_WALLPAPER_MANAGER_DOWNLOAD_CANCEL); | 202 SET_STRING("downloadCanceled", IDS_WALLPAPER_MANAGER_DOWNLOAD_CANCEL); |
203 SET_STRING("customWallpaperWarning", | 203 SET_STRING("customWallpaperWarning", |
204 IDS_WALLPAPER_MANAGER_SHOW_CUSTOM_WALLPAPER_ON_START_WARNING); | 204 IDS_WALLPAPER_MANAGER_SHOW_CUSTOM_WALLPAPER_ON_START_WARNING); |
205 SET_STRING("accessFileFailure", IDS_WALLPAPER_MANAGER_ACCESS_FILE_FAILURE); | 205 SET_STRING("accessFileFailure", IDS_WALLPAPER_MANAGER_ACCESS_FILE_FAILURE); |
206 SET_STRING("invalidWallpaper", IDS_WALLPAPER_MANAGER_INVALID_WALLPAPER); | 206 SET_STRING("invalidWallpaper", IDS_WALLPAPER_MANAGER_INVALID_WALLPAPER); |
207 SET_STRING("learnMore", IDS_LEARN_MORE); | 207 SET_STRING("learnMore", IDS_LEARN_MORE); |
208 #undef SET_STRING | 208 #undef SET_STRING |
209 | 209 |
210 URLDataSource::SetFontAndTextDirection(dict); | 210 web_ui_util::SetFontAndTextDirection(dict); |
211 | 211 |
212 chromeos::WallpaperManager* wallpaper_manager = | 212 chromeos::WallpaperManager* wallpaper_manager = |
213 chromeos::WallpaperManager::Get(); | 213 chromeos::WallpaperManager::Get(); |
214 chromeos::WallpaperInfo info; | 214 chromeos::WallpaperInfo info; |
215 | 215 |
216 if (wallpaper_manager->GetLoggedInUserWallpaperInfo(&info)) { | 216 if (wallpaper_manager->GetLoggedInUserWallpaperInfo(&info)) { |
217 if (info.type == chromeos::User::ONLINE) | 217 if (info.type == chromeos::User::ONLINE) |
218 dict->SetString("currentWallpaper", info.file); | 218 dict->SetString("currentWallpaper", info.file); |
219 else if (info.type == chromeos::User::CUSTOMIZED) | 219 else if (info.type == chromeos::User::CUSTOMIZED) |
220 dict->SetString("currentWallpaper", "CUSTOM"); | 220 dict->SetString("currentWallpaper", "CUSTOM"); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 this, file_list)); | 691 this, file_list)); |
692 } | 692 } |
693 | 693 |
694 void WallpaperGetOfflineWallpaperListFunction::OnComplete( | 694 void WallpaperGetOfflineWallpaperListFunction::OnComplete( |
695 const std::vector<std::string>& file_list) { | 695 const std::vector<std::string>& file_list) { |
696 ListValue* results = new ListValue(); | 696 ListValue* results = new ListValue(); |
697 results->AppendStrings(file_list); | 697 results->AppendStrings(file_list); |
698 SetResult(results); | 698 SetResult(results); |
699 SendResponse(true); | 699 SendResponse(true); |
700 } | 700 } |
OLD | NEW |