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

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

Issue 2060004: Removing the app launcher button on ChromeOS (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: One more clean up 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 | « chrome/browser/browser.h ('k') | chrome/browser/chromeos/frame/browser_view.h » ('j') | no next file with comments »
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #include "chrome/browser/user_data_manager.h" 104 #include "chrome/browser/user_data_manager.h"
105 #include "chrome/browser/view_ids.h" 105 #include "chrome/browser/view_ids.h"
106 #include "chrome/browser/views/app_launcher.h" 106 #include "chrome/browser/views/app_launcher.h"
107 #include "chrome/browser/views/location_bar/location_bar_view.h" 107 #include "chrome/browser/views/location_bar/location_bar_view.h"
108 #endif // OS_WIN 108 #endif // OS_WIN
109 109
110 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
111 #include "chrome/browser/cocoa/find_pasteboard.h" 111 #include "chrome/browser/cocoa/find_pasteboard.h"
112 #endif 112 #endif
113 113
114 #if defined(OS_CHROMEOS)
115 #include "chrome/browser/views/app_launcher.h"
116 #endif
117
114 using base::TimeDelta; 118 using base::TimeDelta;
115 119
116 // How long we wait before updating the browser chrome while loading a page. 120 // How long we wait before updating the browser chrome while loading a page.
117 static const int kUIUpdateCoalescingTimeMS = 200; 121 static const int kUIUpdateCoalescingTimeMS = 200;
118 122
119 // The URL to be loaded to display Help. 123 // The URL to be loaded to display Help.
120 static const char* const kHelpContentUrl = 124 static const char* const kHelpContentUrl =
121 "http://www.google.com/support/chrome/"; 125 "http://www.google.com/support/chrome/";
122 126
123 // The URL to be loaded to display the "Report a broken page" form. 127 // The URL to be loaded to display the "Report a broken page" form.
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 command_updater_.UpdateCommandEnabled( 1042 command_updater_.UpdateCommandEnabled(
1039 IDC_SYNC_BOOKMARKS, show_main_ui && ProfileSyncService::IsSyncEnabled()); 1043 IDC_SYNC_BOOKMARKS, show_main_ui && ProfileSyncService::IsSyncEnabled());
1040 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); 1044 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui);
1041 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); 1045 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui);
1042 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); 1046 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui);
1043 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); 1047 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui);
1044 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); 1048 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui);
1045 command_updater_.UpdateCommandEnabled(IDC_SHOW_PAGE_MENU, show_main_ui); 1049 command_updater_.UpdateCommandEnabled(IDC_SHOW_PAGE_MENU, show_main_ui);
1046 } 1050 }
1047 1051
1052 bool Browser::OpenAppsPanelAsNewTab() {
1053 #if defined(OS_CHROMEOS) || defined(OS_WIN)
1054 CommandLine* command_line = CommandLine::ForCurrentProcess();
1055 if (command_line->HasSwitch(switches::kDisableAppsPanel) ||
1056 (!browser_defaults::kShowAppsPanelForNewTab &&
1057 !command_line->HasSwitch(switches::kAppsPanel))) {
1058 return false;
1059 }
1060 AppLauncher::ShowForNewTab(this, std::string());
1061 return true;
1062 #endif // OS_CHROMEOS || OS_WIN
1063
1064 return false;
1065 }
1066
1048 /////////////////////////////////////////////////////////////////////////////// 1067 ///////////////////////////////////////////////////////////////////////////////
1049 // Browser, Assorted browser commands: 1068 // Browser, Assorted browser commands:
1050 1069
1051 bool Browser::ShouldOpenNewTabForWindowDisposition( 1070 bool Browser::ShouldOpenNewTabForWindowDisposition(
1052 WindowOpenDisposition disposition) { 1071 WindowOpenDisposition disposition) {
1053 return (disposition == NEW_FOREGROUND_TAB || 1072 return (disposition == NEW_FOREGROUND_TAB ||
1054 disposition == NEW_BACKGROUND_TAB); 1073 disposition == NEW_BACKGROUND_TAB);
1055 } 1074 }
1056 1075
1057 NavigationController& Browser::GetOrCloneNavigationControllerForDisposition( 1076 NavigationController& Browser::GetOrCloneNavigationControllerForDisposition(
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 #endif 1260 #endif
1242 } 1261 }
1243 1262
1244 void Browser::CloseWindow() { 1263 void Browser::CloseWindow() {
1245 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_); 1264 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_);
1246 window_->Close(); 1265 window_->Close();
1247 } 1266 }
1248 1267
1249 void Browser::NewTab() { 1268 void Browser::NewTab() {
1250 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_); 1269 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_);
1251 #if defined(OS_WIN) 1270
1252 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsPanel)) { 1271 if (OpenAppsPanelAsNewTab())
1253 AppLauncher::ShowForNewTab(this, std::string());
1254 return; 1272 return;
1255 } 1273
1256 #endif
1257 if (type() == TYPE_NORMAL) { 1274 if (type() == TYPE_NORMAL) {
1258 AddBlankTab(true); 1275 AddBlankTab(true);
1259 } else { 1276 } else {
1260 Browser* b = GetOrCreateTabbedBrowser(profile_); 1277 Browser* b = GetOrCreateTabbedBrowser(profile_);
1261 b->AddBlankTab(true); 1278 b->AddBlankTab(true);
1262 b->window()->Show(); 1279 b->window()->Show();
1263 // The call to AddBlankTab above did not set the focus to the tab as its 1280 // The call to AddBlankTab above did not set the focus to the tab as its
1264 // window was not active, so we have to do it explicitly. 1281 // window was not active, so we have to do it explicitly.
1265 // See http://crbug.com/6380. 1282 // See http://crbug.com/6380.
1266 b->GetSelectedTabContents()->view()->RestoreFocus(); 1283 b->GetSelectedTabContents()->view()->RestoreFocus();
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
3838 if (TabHasUnloadListener(contents)) { 3855 if (TabHasUnloadListener(contents)) {
3839 // If the page has unload listeners, then we tell the renderer to fire 3856 // If the page has unload listeners, then we tell the renderer to fire
3840 // them. Once they have fired, we'll get a message back saying whether 3857 // them. Once they have fired, we'll get a message back saying whether
3841 // to proceed closing the page or not, which sends us back to this method 3858 // to proceed closing the page or not, which sends us back to this method
3842 // with the HasUnloadListener bit cleared. 3859 // with the HasUnloadListener bit cleared.
3843 contents->render_view_host()->FirePageBeforeUnload(false); 3860 contents->render_view_host()->FirePageBeforeUnload(false);
3844 return true; 3861 return true;
3845 } 3862 }
3846 return false; 3863 return false;
3847 } 3864 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/chromeos/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698