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

Side by Side Diff: chrome/browser/ui/extensions/application_launch.cc

Issue 11348344: Remove last usages of FindTabbedBrowserDeprecated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove presubmit check as well. Created 8 years 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/ui/extensions/application_launch.h" 5 #include "chrome/browser/ui/extensions/application_launch.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/extensions/extension_prefs.h" 9 #include "chrome/browser/extensions/extension_prefs.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #if defined(OS_WIN) 114 #if defined(OS_WIN)
115 // In Chrome on Windows 8 in metro mode we don't allow multiple chrome 115 // In Chrome on Windows 8 in metro mode we don't allow multiple chrome
116 // windows to be created, as we don't have a good way to switch between 116 // windows to be created, as we don't have a good way to switch between
117 // them. We attempt to reuse an existing Browser window. 117 // them. We attempt to reuse an existing Browser window.
118 if (base::win::IsMetroProcess()) { 118 if (base::win::IsMetroProcess()) {
119 browser = browser::FindBrowserWithProfile( 119 browser = browser::FindBrowserWithProfile(
120 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 120 profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
121 } 121 }
122 #endif 122 #endif
123 if (!browser) 123 if (!browser)
124 browser = new Browser(params); 124 browser = new Browser(params);
grt (UTC plus 2) 2012/12/03 15:54:39 need context here
robertshield 2012/12/03 20:25:58 Done.
125 125
126 if (app_browser) 126 if (app_browser)
127 *app_browser = browser; 127 *app_browser = browser;
128 128
129 WebContents* web_contents = chrome::AddSelectedTabWithURL( 129 WebContents* web_contents = chrome::AddSelectedTabWithURL(
130 browser, url, content::PAGE_TRANSITION_AUTO_TOPLEVEL); 130 browser, url, content::PAGE_TRANSITION_AUTO_TOPLEVEL);
131 web_contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 131 web_contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
132 web_contents->GetRenderViewHost()->SyncRendererPrefs(); 132 web_contents->GetRenderViewHost()->SyncRendererPrefs();
133 133
134 browser->window()->Show(); 134 browser->window()->Show();
135 135
136 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial 136 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
137 // focus explicitly. 137 // focus explicitly.
138 web_contents->GetView()->SetInitialFocus(); 138 web_contents->GetView()->SetInitialFocus();
139 return web_contents; 139 return web_contents;
140 } 140 }
141 141
142 WebContents* OpenApplicationTab(Profile* profile, 142 WebContents* OpenApplicationTab(Profile* profile,
143 const Extension* extension, 143 const Extension* extension,
144 const GURL& override_url, 144 const GURL& override_url,
145 WindowOpenDisposition disposition) { 145 WindowOpenDisposition disposition) {
146 Browser* browser = browser::FindTabbedBrowserDeprecated(profile, false); 146 Browser* browser = browser::FindTabbedBrowser(profile,
147 false,
148 chrome::GetActiveDesktop());
147 WebContents* contents = NULL; 149 WebContents* contents = NULL;
148 if (!browser) { 150 if (!browser) {
149 // No browser for this profile, need to open a new one. 151 // No browser for this profile, need to open a new one.
150 browser = new Browser(Browser::CreateParams(profile)); 152 browser = new Browser(Browser::CreateParams(profile));
grt (UTC plus 2) 2012/12/03 15:54:39 need context here, too
robertshield 2012/12/03 20:25:58 Done.
151 browser->window()->Show(); 153 browser->window()->Show();
152 // There's no current tab in this browser window, so add a new one. 154 // There's no current tab in this browser window, so add a new one.
153 disposition = NEW_FOREGROUND_TAB; 155 disposition = NEW_FOREGROUND_TAB;
154 } else { 156 } else {
155 // For existing browser, ensure its window is activated. 157 // For existing browser, ensure its window is activated.
156 browser->window()->Activate(); 158 browser->window()->Activate();
157 } 159 }
158 160
159 // Check the prefs for overridden mode. 161 // Check the prefs for overridden mode.
160 ExtensionService* extension_service = profile->GetExtensionService(); 162 ExtensionService* extension_service = profile->GetExtensionService();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // OnDidGetApplicationInfo, which calls 299 // OnDidGetApplicationInfo, which calls
298 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as 300 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
299 // pending web app action. 301 // pending web app action.
300 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( 302 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action(
301 extensions::TabHelper::UPDATE_SHORTCUT); 303 extensions::TabHelper::UPDATE_SHORTCUT);
302 304
303 return tab; 305 return tab;
304 } 306 }
305 307
306 } // namespace application_launch 308 } // namespace application_launch
OLDNEW
« chrome/browser/extensions/extension_tab_util.cc ('K') | « chrome/browser/ui/browser_finder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698