OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/extensions/wallpaper_manager_api.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/file_util.h" | |
9 #include "base/path_service.h" | |
10 #include "chrome/browser/browser_process.h" | |
11 #include "chrome/browser/chromeos/login/user_manager.h" | |
12 #include "chrome/browser/extensions/extension_service.h" | |
13 #include "chrome/browser/profiles/profile.h" | |
14 #include "chrome/browser/profiles/profile_manager.h" | |
15 #include "chrome/browser/ui/browser.h" | |
16 #include "chrome/browser/ui/browser_finder.h" | |
17 #include "chrome/browser/ui/chrome_pages.h" | |
18 #include "chrome/browser/ui/extensions/application_launch.h" | |
19 #include "chrome/common/chrome_paths.h" | |
20 #include "chrome/common/chrome_switches.h" | |
21 #include "chrome/common/url_constants.h" | |
22 #include "content/public/browser/browser_thread.h" | |
23 | |
24 using content::BrowserThread; | |
25 | |
26 #define WALLPAPERMANAGER_EXTENSON_ID "obklkkbkpaoaejdabbfldmcfplpdgolj" | |
27 | |
28 const char kWallpaperManagerDomain[] = WALLPAPERMANAGER_EXTENSON_ID; | |
flackr
2012/07/04 22:20:57
Why not just assign the extension ID directly?
bshe
2012/07/05 13:54:50
Done.
| |
29 | |
30 namespace wallpaper_manager_util { | |
31 | |
32 // Hide behind flag | |
flackr
2012/07/04 22:20:57
Does this comment belong by the if statement?
bshe
2012/07/05 13:54:50
Done.
| |
33 void OpenWallpaperManager() { | |
34 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | |
35 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
36 switches::kExperimentalWallpaperUI)) { | |
37 std::string url = chrome::kChromeUIWallpaperURL; | |
38 ExtensionService* service = profile->GetExtensionService(); | |
39 if (!service) | |
40 return; | |
41 | |
42 const extensions::Extension* extension = | |
43 service->GetExtensionById(kWallpaperManagerDomain, false); | |
44 if (!extension) | |
45 return; | |
46 | |
47 application_launch::OpenApplication(profile, extension, | |
48 extension_misc::LAUNCH_WINDOW, GURL(url), NEW_FOREGROUND_TAB, NULL); | |
49 } else { | |
50 Browser* browser = browser::FindOrCreateTabbedBrowser( | |
51 ProfileManager::GetDefaultProfileOrOffTheRecord()); | |
52 chrome::ShowSettingsSubPage(browser, "setWallpaper"); | |
53 } | |
54 } | |
55 | |
56 } //namespace wallpaper_manager_util | |
OLD | NEW |