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

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

Issue 10537062: TabContentsWrapper -> TabContents, part 13. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiz Created 8 years, 6 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/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/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/extensions/default_apps_trial.h" 10 #include "chrome/browser/extensions/default_apps_trial.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all 285 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all
286 // cases. 286 // cases.
287 browser::NavigateParams params(browser, extension_url, 287 browser::NavigateParams params(browser, extension_url,
288 content::PAGE_TRANSITION_START_PAGE); 288 content::PAGE_TRANSITION_START_PAGE);
289 params.tabstrip_add_types = add_type; 289 params.tabstrip_add_types = add_type;
290 params.disposition = disposition; 290 params.disposition = disposition;
291 291
292 if (disposition == CURRENT_TAB) { 292 if (disposition == CURRENT_TAB) {
293 WebContents* existing_tab = browser->GetSelectedWebContents(); 293 WebContents* existing_tab = browser->GetSelectedWebContents();
294 TabStripModel* model = browser->tab_strip_model(); 294 TabStripModel* model = browser->tab_strip_model();
295 int tab_index = model->GetWrapperIndex(existing_tab); 295 int tab_index = model->GetIndexOfWebContents(existing_tab);
296 296
297 existing_tab->OpenURL(content::OpenURLParams( 297 existing_tab->OpenURL(content::OpenURLParams(
298 extension_url, 298 extension_url,
299 content::Referrer(existing_tab->GetURL(), 299 content::Referrer(existing_tab->GetURL(),
300 WebKit::WebReferrerPolicyDefault), 300 WebKit::WebReferrerPolicyDefault),
301 disposition, content::PAGE_TRANSITION_LINK, false)); 301 disposition, content::PAGE_TRANSITION_LINK, false));
302 // Reset existing_tab as OpenURL() may have clobbered it. 302 // Reset existing_tab as OpenURL() may have clobbered it.
303 existing_tab = browser->GetSelectedWebContents(); 303 existing_tab = browser->GetSelectedWebContents();
304 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { 304 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
305 model->SetTabPinned(tab_index, true); 305 model->SetTabPinned(tab_index, true);
306 // Pinning may have moved the tab. 306 // Pinning may have moved the tab.
307 tab_index = model->GetWrapperIndex(existing_tab); 307 tab_index = model->GetIndexOfWebContents(existing_tab);
308 } 308 }
309 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) 309 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE)
310 model->ActivateTabAt(tab_index, true); 310 model->ActivateTabAt(tab_index, true);
311 311
312 contents = existing_tab; 312 contents = existing_tab;
313 } else { 313 } else {
314 browser::Navigate(&params); 314 browser::Navigate(&params);
315 contents = params.target_contents->web_contents(); 315 contents = params.target_contents->web_contents();
316 } 316 }
317 317
318 #if defined(USE_ASH) 318 #if defined(USE_ASH)
319 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and it should 319 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and it should
320 // not reach here. 320 // not reach here.
321 DCHECK(launch_type != ExtensionPrefs::LAUNCH_FULLSCREEN); 321 DCHECK(launch_type != ExtensionPrefs::LAUNCH_FULLSCREEN);
322 #else 322 #else
323 // TODO(skerner): If we are already in full screen mode, and the user 323 // TODO(skerner): If we are already in full screen mode, and the user
324 // set the app to open as a regular or pinned tab, what should happen? 324 // set the app to open as a regular or pinned tab, what should happen?
325 // Today we open the tab, but stay in full screen mode. Should we leave 325 // Today we open the tab, but stay in full screen mode. Should we leave
326 // full screen mode in this case? 326 // full screen mode in this case?
327 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && 327 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN &&
328 !browser->window()->IsFullscreen()) { 328 !browser->window()->IsFullscreen()) {
329 browser->ToggleFullscreenMode(); 329 browser->ToggleFullscreenMode();
330 } 330 }
331 #endif 331 #endif
332 332
333 return contents; 333 return contents;
334 } 334 }
335 335
336 } // namespace application_launch 336 } // namespace application_launch
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698