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 01b92b031774b5d8839df6aa35072aec717c19af..b04f36bf6cb48d92dccc46f6013524abad8889cc 100644 |
| --- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| +++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc |
| @@ -10,39 +10,14 @@ |
| #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(); |
| @@ -59,28 +34,11 @@ void OpenWallpaperManager() { |
| if (!extension) |
| return; |
| - GURL wallpaper_picker_url(url); |
| - int width = extension->launch_width(); |
| - int height = extension->launch_height(); |
| - const gfx::Size screen = gfx::Screen::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); |
| + params.override_url = GURL(url); |
|
Mihai Parparita -not on Chrome
2012/10/12 00:48:47
This should not be necessary, launching of v2 apps
bshe
2012/10/12 16:28:30
Done.
|
| + application_launch::OpenApplication(params); |
| } else { |
| Browser* browser = browser::FindOrCreateTabbedBrowser( |
| ProfileManager::GetDefaultProfileOrOffTheRecord(), |