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/desktop_background_observer.h" | 5 #include "chrome/browser/chromeos/background/desktop_background_observer.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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { | 22 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { |
23 public: | 23 public: |
24 UserWallpaperDelegate() { | 24 UserWallpaperDelegate() { |
25 } | 25 } |
26 | 26 |
27 virtual ~UserWallpaperDelegate() { | 27 virtual ~UserWallpaperDelegate() { |
28 } | 28 } |
29 | 29 |
30 virtual const int GetUserWallpaperIndex() OVERRIDE { | 30 virtual const int GetUserWallpaperIndex() OVERRIDE { |
31 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 31 return chromeos::UserManager::Get()->GetUserWallpaperIndex(); |
32 // If at login screen or logged in as a guest/incognito user, then use the | |
33 // default wallpaper. | |
34 if (user_manager->IsLoggedInAsGuest() || !user_manager->IsUserLoggedIn()) | |
35 return ash::GetGuestWallpaperIndex(); | |
36 | |
37 const chromeos::User& user = user_manager->GetLoggedInUser(); | |
38 DCHECK(!user.email().empty()); | |
39 int index = user_manager->GetUserWallpaper(user.email()); | |
40 DCHECK(index >=0 && index < ash::GetWallpaperCount()); | |
41 return index; | |
42 } | 32 } |
43 | 33 |
44 virtual void OpenSetWallpaperPage() OVERRIDE { | 34 virtual void OpenSetWallpaperPage() OVERRIDE { |
45 Browser* browser = Browser::GetOrCreateTabbedBrowser( | 35 Browser* browser = Browser::GetOrCreateTabbedBrowser( |
46 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 36 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
47 browser->ShowOptionsTab("setWallpaper"); | 37 browser->ShowOptionsTab("setWallpaper"); |
48 } | 38 } |
49 | 39 |
50 private: | 40 private: |
51 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
(...skipping 23 matching lines...) Expand all Loading... |
75 ash::Shell::GetInstance()->desktop_background_controller()-> | 65 ash::Shell::GetInstance()->desktop_background_controller()-> |
76 OnDesktopBackgroundChanged(); | 66 OnDesktopBackgroundChanged(); |
77 break; | 67 break; |
78 } | 68 } |
79 default: | 69 default: |
80 NOTREACHED(); | 70 NOTREACHED(); |
81 } | 71 } |
82 } | 72 } |
83 | 73 |
84 } // namespace chromeos | 74 } // namespace chromeos |
OLD | NEW |