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/background/ash_user_wallpaper_delegate.h" | 5 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
9 #include "ash/desktop_background/desktop_background_resources.h" | 9 #include "ash/desktop_background/desktop_background_resources.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/chromeos/extensions/wallpaper_manager_api.h" |
11 #include "chrome/browser/chromeos/login/user_manager.h" | 12 #include "chrome/browser/chromeos/login/user_manager.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/chrome_pages.h" | 16 #include "chrome/browser/ui/chrome_pages.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { | 24 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { |
24 public: | 25 public: |
25 UserWallpaperDelegate() { | 26 UserWallpaperDelegate() { |
26 } | 27 } |
27 | 28 |
28 virtual ~UserWallpaperDelegate() { | 29 virtual ~UserWallpaperDelegate() { |
29 } | 30 } |
30 | 31 |
31 virtual void InitializeWallpaper() OVERRIDE { | 32 virtual void InitializeWallpaper() OVERRIDE { |
32 chromeos::UserManager::Get()->InitializeWallpaper(); | 33 chromeos::UserManager::Get()->InitializeWallpaper(); |
33 } | 34 } |
34 | 35 |
35 virtual void OpenSetWallpaperPage() OVERRIDE { | 36 virtual void OpenSetWallpaperPage() OVERRIDE { |
36 Browser* browser = browser::FindOrCreateTabbedBrowser( | 37 wallpaper_manager_util::OpenWallpaperManager(); |
37 ProfileManager::GetDefaultProfileOrOffTheRecord()); | |
38 chrome::ShowSettingsSubPage(browser, "setWallpaper"); | |
39 } | 38 } |
40 | 39 |
41 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 40 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
42 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); | 41 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); |
43 } | 42 } |
44 | 43 |
45 virtual void OnWallpaperAnimationFinished() OVERRIDE { | 44 virtual void OnWallpaperAnimationFinished() OVERRIDE { |
46 content::NotificationService::current()->Notify( | 45 content::NotificationService::current()->Notify( |
47 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 46 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
48 content::NotificationService::AllSources(), | 47 content::NotificationService::AllSources(), |
49 content::NotificationService::NoDetails()); | 48 content::NotificationService::NoDetails()); |
50 } | 49 } |
51 | 50 |
52 private: | 51 private: |
53 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 52 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
54 }; | 53 }; |
55 | 54 |
56 } // namespace | 55 } // namespace |
57 | 56 |
58 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 57 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { |
59 return new chromeos::UserWallpaperDelegate(); | 58 return new chromeos::UserWallpaperDelegate(); |
60 } | 59 } |
61 | 60 |
62 } // namespace chromeos | 61 } // namespace chromeos |
OLD | NEW |