| 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/extensions/wallpaper_manager_util.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/chrome_pages.h" | 17 #include "chrome/browser/ui/chrome_pages.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return; | 56 return; |
| 56 | 57 |
| 57 const extensions::Extension* extension = | 58 const extensions::Extension* extension = |
| 58 service->GetExtensionById(extension_misc::kWallpaperManagerId, false); | 59 service->GetExtensionById(extension_misc::kWallpaperManagerId, false); |
| 59 if (!extension) | 60 if (!extension) |
| 60 return; | 61 return; |
| 61 | 62 |
| 62 GURL wallpaper_picker_url(url); | 63 GURL wallpaper_picker_url(url); |
| 63 int width = extension->launch_width(); | 64 int width = extension->launch_width(); |
| 64 int height = extension->launch_height(); | 65 int height = extension->launch_height(); |
| 65 const gfx::Size screen = gfx::Screen::GetPrimaryDisplay().size(); | 66 const gfx::Size screen = |
| 67 ash::Shell::GetAshScreen()->GetPrimaryDisplay().size(); |
| 66 const gfx::Rect bounds((screen.width() - width) / 2, | 68 const gfx::Rect bounds((screen.width() - width) / 2, |
| 67 (screen.height() - height) / 2, | 69 (screen.height() - height) / 2, |
| 68 width, | 70 width, |
| 69 height); | 71 height); |
| 70 | 72 |
| 71 Browser* browser = GetBrowserForUrl(wallpaper_picker_url); | 73 Browser* browser = GetBrowserForUrl(wallpaper_picker_url); |
| 72 | 74 |
| 73 if (!browser) { | 75 if (!browser) { |
| 74 browser = new Browser( | 76 browser = new Browser( |
| 75 Browser::CreateParams::CreateForApp(Browser::TYPE_POPUP, | 77 Browser::CreateParams::CreateForApp(Browser::TYPE_POPUP, |
| 76 extension->name(), | 78 extension->name(), |
| 77 bounds, | 79 bounds, |
| 78 profile)); | 80 profile)); |
| 79 | 81 |
| 80 chrome::AddSelectedTabWithURL(browser, wallpaper_picker_url, | 82 chrome::AddSelectedTabWithURL(browser, wallpaper_picker_url, |
| 81 content::PAGE_TRANSITION_LINK); | 83 content::PAGE_TRANSITION_LINK); |
| 82 } | 84 } |
| 83 browser->window()->Show(); | 85 browser->window()->Show(); |
| 84 } else { | 86 } else { |
| 85 Browser* browser = browser::FindOrCreateTabbedBrowser( | 87 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 86 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 88 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 87 chrome::HOST_DESKTOP_TYPE_ASH); | 89 chrome::HOST_DESKTOP_TYPE_ASH); |
| 88 chrome::ShowSettingsSubPage(browser, "setWallpaper"); | 90 chrome::ShowSettingsSubPage(browser, "setWallpaper"); |
| 89 } | 91 } |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace wallpaper_manager_util | 94 } // namespace wallpaper_manager_util |
| OLD | NEW |