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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 10801006: Allow secondary tiles to be unpinned. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove NULL check Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | chrome/chrome_browser.gypi » ('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) 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/toolbar/wrench_menu_model.h" 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/sync/sync_global_error.h" 25 #include "chrome/browser/sync/sync_global_error.h"
26 #include "chrome/browser/sync/sync_ui_util.h" 26 #include "chrome/browser/sync/sync_ui_util.h"
27 #include "chrome/browser/task_manager/task_manager.h" 27 #include "chrome/browser/task_manager/task_manager.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_commands.h" 29 #include "chrome/browser/ui/browser_commands.h"
30 #include "chrome/browser/ui/browser_tabstrip.h" 30 #include "chrome/browser/ui/browser_tabstrip.h"
31 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
32 #include "chrome/browser/ui/global_error/global_error.h" 32 #include "chrome/browser/ui/global_error/global_error.h"
33 #include "chrome/browser/ui/global_error/global_error_service.h" 33 #include "chrome/browser/ui/global_error/global_error_service.h"
34 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 34 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
35 #include "chrome/browser/ui/metro_pin_tab_helper.h"
36 #include "chrome/browser/ui/tab_contents/tab_contents.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 37 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 38 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
37 #include "chrome/browser/upgrade_detector.h" 39 #include "chrome/browser/upgrade_detector.h"
38 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
39 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
41 #include "chrome/common/profiling.h" 43 #include "chrome/common/profiling.h"
42 #include "content/public/browser/host_zoom_map.h" 44 #include "content/public/browser/host_zoom_map.h"
43 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/notification_source.h" 46 #include "content/public/browser/notification_source.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return command_id != IDC_ZOOM_MINUS && command_id != IDC_ZOOM_PLUS; 234 return command_id != IDC_ZOOM_MINUS && command_id != IDC_ZOOM_PLUS;
233 } 235 }
234 236
235 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const { 237 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const {
236 return command_id == IDC_ZOOM_PERCENT_DISPLAY || 238 return command_id == IDC_ZOOM_PERCENT_DISPLAY ||
237 #if defined(OS_MACOSX) 239 #if defined(OS_MACOSX)
238 command_id == IDC_FULLSCREEN || 240 command_id == IDC_FULLSCREEN ||
239 #endif 241 #endif
240 command_id == IDC_VIEW_BACKGROUND_PAGES || 242 command_id == IDC_VIEW_BACKGROUND_PAGES ||
241 command_id == IDC_UPGRADE_DIALOG || 243 command_id == IDC_UPGRADE_DIALOG ||
242 command_id == IDC_SHOW_SYNC_SETUP; 244 command_id == IDC_SHOW_SYNC_SETUP ||
245 command_id == IDC_PIN_TO_START_SCREEN;
243 } 246 }
244 247
245 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { 248 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
246 switch (command_id) { 249 switch (command_id) {
247 case IDC_ZOOM_PERCENT_DISPLAY: 250 case IDC_ZOOM_PERCENT_DISPLAY:
248 return zoom_label_; 251 return zoom_label_;
249 #if defined(OS_MACOSX) 252 #if defined(OS_MACOSX)
250 case IDC_FULLSCREEN: { 253 case IDC_FULLSCREEN: {
251 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter. 254 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter.
252 // Note: On startup, |window()| may be NULL. 255 // Note: On startup, |window()| may be NULL.
(...skipping 21 matching lines...) Expand all
274 std::string username = browser_->profile()->GetPrefs()->GetString( 277 std::string username = browser_->profile()->GetPrefs()->GetString(
275 prefs::kGoogleServicesUsername); 278 prefs::kGoogleServicesUsername);
276 if (!username.empty()) { 279 if (!username.empty()) {
277 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, 280 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL,
278 UTF8ToUTF16(username)); 281 UTF8ToUTF16(username));
279 } 282 }
280 } 283 }
281 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL, 284 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL,
282 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 285 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
283 } 286 }
287 case IDC_PIN_TO_START_SCREEN: {
288 int string_id = IDS_PIN_TO_START_SCREEN;
289 TabContents* tab_contents = chrome::GetActiveTabContents(browser_);
290 if (tab_contents && tab_contents->metro_pin_tab_helper()->is_pinned()) {
291 string_id = IDS_UNPIN_FROM_START_SCREEN;
292 }
293 return l10n_util::GetStringUTF16(string_id);
294 }
284 default: 295 default:
285 NOTREACHED(); 296 NOTREACHED();
286 return string16(); 297 return string16();
287 } 298 }
288 } 299 }
289 300
290 bool WrenchMenuModel::GetIconForCommandId(int command_id, 301 bool WrenchMenuModel::GetIconForCommandId(int command_id,
291 gfx::ImageSkia* icon) const { 302 gfx::ImageSkia* icon) const {
292 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 303 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
293 switch (command_id) { 304 switch (command_id) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 zoom_label_ = l10n_util::GetStringFUTF16( 638 zoom_label_ = l10n_util::GetStringFUTF16(
628 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 639 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
629 } 640 }
630 641
631 string16 WrenchMenuModel::GetSyncMenuLabel() const { 642 string16 WrenchMenuModel::GetSyncMenuLabel() const {
632 Profile* profile = browser_->profile()->GetOriginalProfile(); 643 Profile* profile = browser_->profile()->GetOriginalProfile();
633 return sync_ui_util::GetSyncMenuLabel( 644 return sync_ui_util::GetSyncMenuLabel(
634 ProfileSyncServiceFactory::GetForProfile(profile), 645 ProfileSyncServiceFactory::GetForProfile(profile),
635 *SigninManagerFactory::GetForProfile(profile)); 646 *SigninManagerFactory::GetForProfile(profile));
636 } 647 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698