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

Side by Side Diff: chrome/browser/browser.cc

Issue 1991009: Shorten several apps-related flags (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/browser_init.cc » ('j') | chrome/common/chrome_switches.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } 1242 }
1243 1243
1244 void Browser::CloseWindow() { 1244 void Browser::CloseWindow() {
1245 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_); 1245 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_);
1246 window_->Close(); 1246 window_->Close();
1247 } 1247 }
1248 1248
1249 void Browser::NewTab() { 1249 void Browser::NewTab() {
1250 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_); 1250 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_);
1251 #if defined(OS_WIN) 1251 #if defined(OS_WIN)
1252 if (CommandLine::ForCurrentProcess()->HasSwitch( 1252 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsPanel)) {
1253 switches::kAppLauncherForNewTab)) {
1254 AppLauncher::ShowForNewTab(this, std::string()); 1253 AppLauncher::ShowForNewTab(this, std::string());
1255 return; 1254 return;
1256 } 1255 }
1257 #endif 1256 #endif
1258 if (type() == TYPE_NORMAL) { 1257 if (type() == TYPE_NORMAL) {
1259 AddBlankTab(true); 1258 AddBlankTab(true);
1260 } else { 1259 } else {
1261 Browser* b = GetOrCreateTabbedBrowser(profile_); 1260 Browser* b = GetOrCreateTabbedBrowser(profile_);
1262 b->AddBlankTab(true); 1261 b->AddBlankTab(true);
1263 b->window()->Show(); 1262 b->window()->Show();
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 void Browser::ExecuteCommand(int id) { 2052 void Browser::ExecuteCommand(int id) {
2054 ExecuteCommandWithDisposition(id, CURRENT_TAB); 2053 ExecuteCommandWithDisposition(id, CURRENT_TAB);
2055 } 2054 }
2056 2055
2057 /////////////////////////////////////////////////////////////////////////////// 2056 ///////////////////////////////////////////////////////////////////////////////
2058 // Browser, TabStripModelDelegate implementation: 2057 // Browser, TabStripModelDelegate implementation:
2059 2058
2060 TabContents* Browser::AddBlankTab(bool foreground) { 2059 TabContents* Browser::AddBlankTab(bool foreground) {
2061 // To make a more "launchy" experience, try to reuse an existing NTP if there 2060 // To make a more "launchy" experience, try to reuse an existing NTP if there
2062 // is one. 2061 // is one.
2063 if (CommandLine::ForCurrentProcess()->HasSwitch( 2062 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) {
2064 switches::kEnableExtensionApps)) {
2065 for (int i = tabstrip_model_.count() - 1; i >= 0; --i) { 2063 for (int i = tabstrip_model_.count() - 1; i >= 0; --i) {
2066 TabContents* contents = tabstrip_model_.GetTabContentsAt(i); 2064 TabContents* contents = tabstrip_model_.GetTabContentsAt(i);
2067 if (StartsWithASCII(contents->GetURL().spec(), 2065 if (StartsWithASCII(contents->GetURL().spec(),
2068 chrome::kChromeUINewTabURL, true)) { 2066 chrome::kChromeUINewTabURL, true)) {
2069 if (foreground) 2067 if (foreground)
2070 SelectTabContentsAt(i, true); 2068 SelectTabContentsAt(i, true);
2071 2069
2072 return contents; 2070 return contents;
2073 } 2071 }
2074 } 2072 }
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 if (TabHasUnloadListener(contents)) { 3837 if (TabHasUnloadListener(contents)) {
3840 // If the page has unload listeners, then we tell the renderer to fire 3838 // If the page has unload listeners, then we tell the renderer to fire
3841 // them. Once they have fired, we'll get a message back saying whether 3839 // them. Once they have fired, we'll get a message back saying whether
3842 // to proceed closing the page or not, which sends us back to this method 3840 // to proceed closing the page or not, which sends us back to this method
3843 // with the HasUnloadListener bit cleared. 3841 // with the HasUnloadListener bit cleared.
3844 contents->render_view_host()->FirePageBeforeUnload(false); 3842 contents->render_view_host()->FirePageBeforeUnload(false);
3845 return true; 3843 return true;
3846 } 3844 }
3847 return false; 3845 return false;
3848 } 3846 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_init.cc » ('j') | chrome/common/chrome_switches.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698