Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_manager_util.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix new addition Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // TODO(oshima|bshe): Open WallpaperManager in the display is is requested.
67 const gfx::Size screen =
68 ash::Shell::GetScreen()->GetPrimaryDisplay().size();
66 const gfx::Rect bounds((screen.width() - width) / 2, 69 const gfx::Rect bounds((screen.width() - width) / 2,
67 (screen.height() - height) / 2, 70 (screen.height() - height) / 2,
68 width, 71 width,
69 height); 72 height);
70 73
71 Browser* browser = GetBrowserForUrl(wallpaper_picker_url); 74 Browser* browser = GetBrowserForUrl(wallpaper_picker_url);
72 75
73 if (!browser) { 76 if (!browser) {
74 browser = new Browser( 77 browser = new Browser(
75 Browser::CreateParams::CreateForApp(Browser::TYPE_POPUP, 78 Browser::CreateParams::CreateForApp(Browser::TYPE_POPUP,
76 extension->name(), 79 extension->name(),
77 bounds, 80 bounds,
78 profile)); 81 profile));
79 82
80 chrome::AddSelectedTabWithURL(browser, wallpaper_picker_url, 83 chrome::AddSelectedTabWithURL(browser, wallpaper_picker_url,
81 content::PAGE_TRANSITION_LINK); 84 content::PAGE_TRANSITION_LINK);
82 } 85 }
83 browser->window()->Show(); 86 browser->window()->Show();
84 } else { 87 } else {
85 Browser* browser = browser::FindOrCreateTabbedBrowser( 88 Browser* browser = browser::FindOrCreateTabbedBrowser(
86 ProfileManager::GetDefaultProfileOrOffTheRecord(), 89 ProfileManager::GetDefaultProfileOrOffTheRecord(),
87 chrome::HOST_DESKTOP_TYPE_ASH); 90 chrome::HOST_DESKTOP_TYPE_ASH);
88 chrome::ShowSettingsSubPage(browser, "setWallpaper"); 91 chrome::ShowSettingsSubPage(browser, "setWallpaper");
89 } 92 }
90 } 93 }
91 94
92 } // namespace wallpaper_manager_util 95 } // namespace wallpaper_manager_util
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager_util.cc ('k') | chrome/browser/chromeos/input_method/candidate_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698