Chromium Code Reviews| 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 const char kWallpaperManagerDomain[] = "obklkkbkpaoaejdabbfldmcfplpdgolj"; | |
| 27 | |
| 28 namespace wallpaper_manager_util { | |
| 29 | |
| 30 void OpenWallpaperManager() { | |
| 31 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | |
| 32 // Hides the new UI container behind a flag. | |
| 33 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 34 switches::kExperimentalWallpaperUI)) { | |
| 35 std::string url = chrome::kChromeUIWallpaperURL; | |
| 36 ExtensionService* service = profile->GetExtensionService(); | |
| 37 if (!service) | |
| 38 return; | |
| 39 | |
| 40 const extensions::Extension* extension = | |
| 41 service->GetExtensionById(kWallpaperManagerDomain, false); | |
| 42 if (!extension) | |
| 43 return; | |
| 44 | |
| 45 application_launch::OpenApplication(profile, extension, | |
| 46 extension_misc::LAUNCH_WINDOW, GURL(url), NEW_FOREGROUND_TAB, NULL); | |
| 47 } else { | |
| 48 Browser* browser = browser::FindOrCreateTabbedBrowser( | |
| 49 ProfileManager::GetDefaultProfileOrOffTheRecord()); | |
| 50 chrome::ShowSettingsSubPage(browser, "setWallpaper"); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 } //namespace wallpaper_manager_util | |
|
flackr
2012/07/09 21:29:58
Space after //.
bshe
2012/07/10 01:39:22
Done.
| |
| OLD | NEW |