Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| diff --git a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| index c72428f8e1ce3717e85db82cc76881c4671a2e51..5d6d2895ea2cd7259601a601d24a4dd0f9119cef 100644 |
| --- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| +++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| @@ -11,43 +11,16 @@ |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| -#include "chrome/browser/ui/browser_list.h" |
| -#include "chrome/browser/ui/browser_tabstrip.h" |
| -#include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/chrome_pages.h" |
| +#include "chrome/browser/ui/extensions/application_launch.h" |
| #include "chrome/browser/ui/host_desktop.h" |
| -#include "chrome/browser/ui/tab_contents/tab_contents.h" |
| -#include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/extensions/extension_constants.h" |
| -#include "chrome/common/url_constants.h" |
| -#include "content/public/browser/web_contents.h" |
| -#include "ui/gfx/screen.h" |
| namespace wallpaper_manager_util { |
| -namespace { |
| - |
| -Browser* GetBrowserForUrl(GURL target_url) { |
| - for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); |
| - browser_iterator != BrowserList::end(); ++browser_iterator) { |
| - Browser* browser = *browser_iterator; |
| - TabStripModel* tab_strip = browser->tab_strip_model(); |
| - for (int idx = 0; idx < tab_strip->count(); idx++) { |
| - content::WebContents* web_contents = |
| - tab_strip->GetTabContentsAt(idx)->web_contents(); |
| - const GURL& url = web_contents->GetURL(); |
| - if (url == target_url) |
| - return browser; |
| - } |
| - } |
| - return NULL; |
| -} |
| - |
| -} // namespace |
| void OpenWallpaperManager() { |
| Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| - std::string url = chrome::kChromeUIWallpaperURL; |
| ExtensionService* service = profile->GetExtensionService(); |
| if (!service) |
| return; |
| @@ -57,30 +30,10 @@ void OpenWallpaperManager() { |
| if (!extension) |
| return; |
| - GURL wallpaper_picker_url(url); |
| - int width = extension->launch_width(); |
| - int height = extension->launch_height(); |
| - // TODO(oshima|bshe): Open WallpaperManager in the display is is requested. |
| - const gfx::Size screen = |
| - ash::Shell::GetScreen()->GetPrimaryDisplay().size(); |
| - const gfx::Rect bounds((screen.width() - width) / 2, |
| - (screen.height() - height) / 2, |
| - width, |
| - height); |
| - |
| - Browser* browser = GetBrowserForUrl(wallpaper_picker_url); |
| - |
| - if (!browser) { |
| - browser = new Browser( |
| - Browser::CreateParams::CreateForApp(Browser::TYPE_POPUP, |
| - extension->name(), |
| - bounds, |
| - profile)); |
| - |
| - chrome::AddSelectedTabWithURL(browser, wallpaper_picker_url, |
| - content::PAGE_TRANSITION_LINK); |
| - } |
| - browser->window()->Show(); |
| + application_launch::LaunchParams params(profile, extension, |
| + extension_misc::LAUNCH_WINDOW, |
| + NEW_FOREGROUND_TAB); |
|
flackr
2012/11/12 22:00:34
We seem to ignore these parameters for v2 apps any
bshe
2012/11/12 23:53:38
Right. The parameter seems ignored for v2 app. I d
|
| + application_launch::OpenApplication(params); |
| } |
| } // namespace wallpaper_manager_util |