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

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

Issue 10800054: Add pin icon to the omnibar in windows 8 metro mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux tests 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/metro_pinned_state_observer.h ('k') | chrome/browser/ui/view_ids.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) 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const { 237 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const {
238 return command_id == IDC_ZOOM_PERCENT_DISPLAY || 238 return command_id == IDC_ZOOM_PERCENT_DISPLAY ||
239 #if defined(OS_MACOSX) 239 #if defined(OS_MACOSX)
240 command_id == IDC_FULLSCREEN || 240 command_id == IDC_FULLSCREEN ||
241 #endif 241 #endif
242 command_id == IDC_VIEW_BACKGROUND_PAGES || 242 command_id == IDC_VIEW_BACKGROUND_PAGES ||
243 command_id == IDC_UPGRADE_DIALOG || 243 command_id == IDC_UPGRADE_DIALOG ||
244 command_id == IDC_SHOW_SYNC_SETUP || 244 command_id == IDC_SHOW_SYNC_SETUP ||
245 command_id == IDC_PIN_TO_START_SCREEN; 245 command_id == IDC_METRO_PIN_TO_START_SCREEN;
246 } 246 }
247 247
248 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { 248 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
249 switch (command_id) { 249 switch (command_id) {
250 case IDC_ZOOM_PERCENT_DISPLAY: 250 case IDC_ZOOM_PERCENT_DISPLAY:
251 return zoom_label_; 251 return zoom_label_;
252 #if defined(OS_MACOSX) 252 #if defined(OS_MACOSX)
253 case IDC_FULLSCREEN: { 253 case IDC_FULLSCREEN: {
254 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter. 254 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter.
255 // Note: On startup, |window()| may be NULL. 255 // Note: On startup, |window()| may be NULL.
(...skipping 21 matching lines...) Expand all
277 std::string username = browser_->profile()->GetPrefs()->GetString( 277 std::string username = browser_->profile()->GetPrefs()->GetString(
278 prefs::kGoogleServicesUsername); 278 prefs::kGoogleServicesUsername);
279 if (!username.empty()) { 279 if (!username.empty()) {
280 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, 280 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL,
281 UTF8ToUTF16(username)); 281 UTF8ToUTF16(username));
282 } 282 }
283 } 283 }
284 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL, 284 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL,
285 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 285 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
286 } 286 }
287 case IDC_PIN_TO_START_SCREEN: { 287 case IDC_METRO_PIN_TO_START_SCREEN: {
288 int string_id = IDS_PIN_TO_START_SCREEN; 288 int string_id = IDS_METRO_PIN_TO_START_SCREEN;
289 TabContents* tab_contents = chrome::GetActiveTabContents(browser_); 289 TabContents* tab_contents = chrome::GetActiveTabContents(browser_);
290 if (tab_contents && tab_contents->metro_pin_tab_helper()->is_pinned()) { 290 if (tab_contents && tab_contents->metro_pin_tab_helper()->is_pinned()) {
291 string_id = IDS_UNPIN_FROM_START_SCREEN; 291 string_id = IDS_METRO_UNPIN_FROM_START_SCREEN;
292 } 292 }
293 return l10n_util::GetStringUTF16(string_id); 293 return l10n_util::GetStringUTF16(string_id);
294 } 294 }
295 default: 295 default:
296 NOTREACHED(); 296 NOTREACHED();
297 return string16(); 297 return string16();
298 } 298 }
299 } 299 }
300 300
301 bool WrenchMenuModel::GetIconForCommandId(int command_id, 301 bool WrenchMenuModel::GetIconForCommandId(int command_id,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { 378 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const {
379 #if defined(OS_WIN) 379 #if defined(OS_WIN)
380 if (command_id == IDC_VIEW_INCOMPATIBILITIES) { 380 if (command_id == IDC_VIEW_INCOMPATIBILITIES) {
381 EnumerateModulesModel* loaded_modules = 381 EnumerateModulesModel* loaded_modules =
382 EnumerateModulesModel::GetInstance(); 382 EnumerateModulesModel::GetInstance();
383 if (loaded_modules->confirmed_bad_modules_detected() <= 0) 383 if (loaded_modules->confirmed_bad_modules_detected() <= 0)
384 return false; 384 return false;
385 loaded_modules->AcknowledgeConflictNotification(); 385 loaded_modules->AcknowledgeConflictNotification();
386 return true; 386 return true;
387 } else if (command_id == IDC_PIN_TO_START_SCREEN) { 387 } else if (command_id == IDC_METRO_PIN_TO_START_SCREEN) {
388 return base::win::IsMetroProcess(); 388 return base::win::IsMetroProcess();
389 #else 389 #else
390 if (command_id == IDC_VIEW_INCOMPATIBILITIES || 390 if (command_id == IDC_VIEW_INCOMPATIBILITIES ||
391 command_id == IDC_PIN_TO_START_SCREEN) { 391 command_id == IDC_METRO_PIN_TO_START_SCREEN) {
392 return false; 392 return false;
393 #endif 393 #endif
394 } else if (command_id == IDC_UPGRADE_DIALOG) { 394 } else if (command_id == IDC_UPGRADE_DIALOG) {
395 return UpgradeDetector::GetInstance()->notify_upgrade(); 395 return UpgradeDetector::GetInstance()->notify_upgrade();
396 } else if (command_id == IDC_VIEW_BACKGROUND_PAGES) { 396 } else if (command_id == IDC_VIEW_BACKGROUND_PAGES) {
397 return TaskManager::GetBackgroundPageCount() > 0; 397 return TaskManager::GetBackgroundPageCount() > 0;
398 } 398 }
399 return true; 399 return true;
400 } 400 }
401 401
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); 455 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
456 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); 456 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW);
457 #if defined(OS_CHROMEOS) 457 #if defined(OS_CHROMEOS)
458 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) 458 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession))
459 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); 459 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
460 #else 460 #else
461 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); 461 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
462 #endif 462 #endif
463 463
464 AddItemWithStringId(IDC_PIN_TO_START_SCREEN, IDS_PIN_TO_START_SCREEN); 464 AddItemWithStringId(IDC_METRO_PIN_TO_START_SCREEN,
465 IDS_METRO_PIN_TO_START_SCREEN);
465 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); 466 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_));
466 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, 467 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU,
467 bookmark_sub_menu_model_.get()); 468 bookmark_sub_menu_model_.get());
468 469
469 // Append the full menu including separators. The final separator only gets 470 // Append the full menu including separators. The final separator only gets
470 // appended when this is a touch menu - otherwise it would get added twice. 471 // appended when this is a touch menu - otherwise it would get added twice.
471 CreateCutCopyPasteMenu(is_touch_menu); 472 CreateCutCopyPasteMenu(is_touch_menu);
472 473
473 if (!is_touch_menu) 474 if (!is_touch_menu)
474 CreateZoomMenu(); 475 CreateZoomMenu();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 zoom_label_ = l10n_util::GetStringFUTF16( 639 zoom_label_ = l10n_util::GetStringFUTF16(
639 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 640 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
640 } 641 }
641 642
642 string16 WrenchMenuModel::GetSyncMenuLabel() const { 643 string16 WrenchMenuModel::GetSyncMenuLabel() const {
643 Profile* profile = browser_->profile()->GetOriginalProfile(); 644 Profile* profile = browser_->profile()->GetOriginalProfile();
644 return sync_ui_util::GetSyncMenuLabel( 645 return sync_ui_util::GetSyncMenuLabel(
645 ProfileSyncServiceFactory::GetForProfile(profile), 646 ProfileSyncServiceFactory::GetForProfile(profile),
646 *SigninManagerFactory::GetForProfile(profile)); 647 *SigninManagerFactory::GetForProfile(profile));
647 } 648 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/metro_pinned_state_observer.h ('k') | chrome/browser/ui/view_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698