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

Side by Side Diff: chrome/browser/ui/browser_command_controller.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: 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
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/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 23 matching lines...) Expand all
34 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 35 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_source.h" 36 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/content_restriction.h" 38 #include "content/public/common/content_restriction.h"
39 #include "content/public/common/url_constants.h" 39 #include "content/public/common/url_constants.h"
40 #include "ui/base/keycodes/keyboard_codes.h" 40 #include "ui/base/keycodes/keyboard_codes.h"
41 41
42 #if defined(OS_WIN) 42 #if defined(OS_WIN)
43 #include "base/win/metro.h" 43 #include "base/win/metro.h"
44 #include "chrome/browser/ui/metro_pin_tab_helper.h"
44 #endif 45 #endif
45 46
46 using content::WebContents; 47 using content::WebContents;
47 using content::NavigationEntry; 48 using content::NavigationEntry;
48 using content::NavigationController; 49 using content::NavigationController;
49 using content::WebContents; 50 using content::WebContents;
50 51
51 namespace { 52 namespace {
52 53
53 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. 54 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise.
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 Exit(); 345 Exit();
345 break; 346 break;
346 347
347 // Page-related commands 348 // Page-related commands
348 case IDC_SAVE_PAGE: 349 case IDC_SAVE_PAGE:
349 SavePage(browser_); 350 SavePage(browser_);
350 break; 351 break;
351 case IDC_BOOKMARK_PAGE: 352 case IDC_BOOKMARK_PAGE:
352 BookmarkCurrentPage(browser_); 353 BookmarkCurrentPage(browser_);
353 break; 354 break;
354 case IDC_PIN_TO_START_SCREEN: 355 case IDC_METRO_PIN_TO_START_SCREEN:
355 TogglePagePinnedToStartScreen(browser_); 356 TogglePagePinnedToStartScreen(browser_);
356 break; 357 break;
357 case IDC_BOOKMARK_ALL_TABS: 358 case IDC_BOOKMARK_ALL_TABS:
358 BookmarkAllTabs(browser_); 359 BookmarkAllTabs(browser_);
359 break; 360 break;
360 case IDC_VIEW_SOURCE: 361 case IDC_VIEW_SOURCE:
361 ViewSelectedSource(browser_); 362 ViewSelectedSource(browser_);
362 break; 363 break;
363 case IDC_EMAIL_PAGE_LOCATION: 364 case IDC_EMAIL_PAGE_LOCATION:
364 EmailPageLocation(browser_); 365 EmailPageLocation(browser_);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, 864 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
864 CanReload(browser_)); 865 CanReload(browser_));
865 866
866 // Window management commands 867 // Window management commands
867 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 868 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
868 !browser_->is_app() && CanDuplicateTab(browser_)); 869 !browser_->is_app() && CanDuplicateTab(browser_));
869 870
870 // Page-related commands 871 // Page-related commands
871 window()->SetStarredState( 872 window()->SetStarredState(
872 current_tab_contents->bookmark_tab_helper()->is_starred()); 873 current_tab_contents->bookmark_tab_helper()->is_starred());
874 #if defined(OS_WIN)
875 window()->SetMetroPinnedState(
876 current_tab_contents->metro_pin_tab_helper()->is_pinned());
877 #endif
873 window()->SetZoomIconState( 878 window()->SetZoomIconState(
874 current_tab_contents->zoom_controller()->zoom_icon_state()); 879 current_tab_contents->zoom_controller()->zoom_icon_state());
875 window()->SetZoomIconTooltipPercent( 880 window()->SetZoomIconTooltipPercent(
876 current_tab_contents->zoom_controller()->zoom_percent()); 881 current_tab_contents->zoom_controller()->zoom_percent());
877 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 882 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
878 CanViewSource(browser_)); 883 CanViewSource(browser_));
879 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 884 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
880 CanEmailPageLocation(browser_)); 885 CanEmailPageLocation(browser_));
881 if (browser_->is_devtools()) 886 if (browser_->is_devtools())
882 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); 887 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 dev_tools_enabled); 928 dev_tools_enabled);
924 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, 929 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT,
925 dev_tools_enabled); 930 dev_tools_enabled);
926 } 931 }
927 932
928 void BrowserCommandController::UpdateCommandsForBookmarkEditing() { 933 void BrowserCommandController::UpdateCommandsForBookmarkEditing() {
929 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, 934 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE,
930 CanBookmarkCurrentPage(browser_)); 935 CanBookmarkCurrentPage(browser_));
931 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, 936 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS,
932 CanBookmarkAllTabs(browser_)); 937 CanBookmarkAllTabs(browser_));
933 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, 938 command_updater_.UpdateCommandEnabled(IDC_METRO_PIN_TO_START_SCREEN,
934 true); 939 true);
935 } 940 }
936 941
937 void BrowserCommandController::UpdateCommandsForBookmarkBar() { 942 void BrowserCommandController::UpdateCommandsForBookmarkBar() {
938 const bool show_main_ui = 943 const bool show_main_ui =
939 IsShowingMainUI(window() && window()->IsFullscreen()); 944 IsShowingMainUI(window() && window()->IsFullscreen());
940 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, 945 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR,
941 browser_defaults::bookmarks_enabled && 946 browser_defaults::bookmarks_enabled &&
942 !profile()->GetPrefs()->IsManagedPreference(prefs::kShowBookmarkBar) && 947 !profile()->GetPrefs()->IsManagedPreference(prefs::kShowBookmarkBar) &&
943 show_main_ui); 948 show_main_ui);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 1071
1067 BrowserWindow* BrowserCommandController::window() { 1072 BrowserWindow* BrowserCommandController::window() {
1068 return browser_->window(); 1073 return browser_->window();
1069 } 1074 }
1070 1075
1071 Profile* BrowserCommandController::profile() { 1076 Profile* BrowserCommandController::profile() {
1072 return browser_->profile(); 1077 return browser_->profile();
1073 } 1078 }
1074 1079
1075 } // namespace chrome 1080 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698