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

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

Issue 161293002: mac: Allows extensions to hide the bookmark page menu item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 10 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
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"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/search/search.h" 20 #include "chrome/browser/search/search.h"
21 #include "chrome/browser/signin/signin_manager.h" 21 #include "chrome/browser/signin/signin_manager.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 22 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/signin/signin_ui_util.h" 23 #include "chrome/browser/signin/signin_ui_util.h"
24 #include "chrome/browser/task_manager/task_manager.h" 24 #include "chrome/browser/task_manager/task_manager.h"
25 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
25 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_commands.h" 27 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/global_error/global_error.h" 30 #include "chrome/browser/ui/global_error/global_error.h"
30 #include "chrome/browser/ui/global_error/global_error_service.h" 31 #include "chrome/browser/ui/global_error/global_error_service.h"
31 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 32 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" 33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
33 #include "chrome/browser/ui/toolbar/bookmark_sub_menu_model.h" 34 #include "chrome/browser/ui/toolbar/bookmark_sub_menu_model.h"
34 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 35 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } else if (command_id == IDC_PIN_TO_START_SCREEN) { 416 } else if (command_id == IDC_PIN_TO_START_SCREEN) {
416 return base::win::IsMetroProcess(); 417 return base::win::IsMetroProcess();
417 #else 418 #else
418 if (command_id == IDC_VIEW_INCOMPATIBILITIES || 419 if (command_id == IDC_VIEW_INCOMPATIBILITIES ||
419 command_id == IDC_PIN_TO_START_SCREEN) { 420 command_id == IDC_PIN_TO_START_SCREEN) {
420 return false; 421 return false;
421 #endif 422 #endif
422 } else if (command_id == IDC_UPGRADE_DIALOG) { 423 } else if (command_id == IDC_UPGRADE_DIALOG) {
423 return UpgradeDetector::GetInstance()->notify_upgrade(); 424 return UpgradeDetector::GetInstance()->notify_upgrade();
424 } 425 }
426
427 // Extensions have the ability to hide the bookmark page menu item.
428 if (command_id == IDC_BOOKMARK_PAGE)
429 return chrome::ShouldShowBookmarkPageMenuItem(browser_->profile());
430
425 return true; 431 return true;
426 } 432 }
427 433
428 bool WrenchMenuModel::GetAcceleratorForCommandId( 434 bool WrenchMenuModel::GetAcceleratorForCommandId(
429 int command_id, 435 int command_id,
430 ui::Accelerator* accelerator) { 436 ui::Accelerator* accelerator) {
431 return provider_->GetAcceleratorForCommandId(command_id, accelerator); 437 return provider_->GetAcceleratorForCommandId(command_id, accelerator);
432 } 438 }
433 439
434 void WrenchMenuModel::ActiveTabChanged(WebContents* old_contents, 440 void WrenchMenuModel::ActiveTabChanged(WebContents* old_contents,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 &enable_increment, &enable_decrement); 789 &enable_increment, &enable_decrement);
784 } 790 }
785 zoom_label_ = l10n_util::GetStringFUTF16( 791 zoom_label_ = l10n_util::GetStringFUTF16(
786 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 792 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
787 } 793 }
788 794
789 void WrenchMenuModel::OnZoomLevelChanged( 795 void WrenchMenuModel::OnZoomLevelChanged(
790 const content::HostZoomMap::ZoomLevelChange& change) { 796 const content::HostZoomMap::ZoomLevelChange& change) {
791 UpdateZoomControls(); 797 UpdateZoomControls();
792 } 798 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698