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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc

Issue 10560015: Implement base::win::IsMetroProcess. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 8 years, 6 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/views/bookmarks/bookmark_context_menu_controller_vie ws_win.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_vie ws_win.h"
6 6
7 #include "base/win/metro.h" 7 #include "base/win/metro.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/bookmarks/bookmark_utils.h" 9 #include "chrome/browser/bookmarks/bookmark_utils.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 25 matching lines...) Expand all
36 const std::vector<const BookmarkNode*>& selection) 36 const std::vector<const BookmarkNode*>& selection)
37 : BookmarkContextMenuControllerViews(parent_widget, delegate, profile, 37 : BookmarkContextMenuControllerViews(parent_widget, delegate, profile,
38 navigator, parent, selection) { 38 navigator, parent, selection) {
39 } 39 }
40 40
41 BookmarkContextMenuControllerViewsWin 41 BookmarkContextMenuControllerViewsWin
42 ::~BookmarkContextMenuControllerViewsWin() { 42 ::~BookmarkContextMenuControllerViewsWin() {
43 } 43 }
44 44
45 void BookmarkContextMenuControllerViewsWin::ExecuteCommand(int id) { 45 void BookmarkContextMenuControllerViewsWin::ExecuteCommand(int id) {
46 if (base::win::GetMetroModule()) { 46 if (base::win::IsMetroProcess()) {
47 switch (id) { 47 switch (id) {
48 // We need to handle the open in new window and open in incognito window 48 // We need to handle the open in new window and open in incognito window
49 // commands to ensure that they first look for an existing browser object 49 // commands to ensure that they first look for an existing browser object
50 // to handle the request. If we find one then a new foreground tab is 50 // to handle the request. If we find one then a new foreground tab is
51 // opened, else a new browser object is created. 51 // opened, else a new browser object is created.
52 case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW: 52 case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW:
53 case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO: { 53 case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO: {
54 Profile* profile_to_use = profile(); 54 Profile* profile_to_use = profile();
55 if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) { 55 if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) {
56 if (profile_to_use->IsOffTheRecord()) 56 if (profile_to_use->IsOffTheRecord())
(...skipping 22 matching lines...) Expand all
79 default: 79 default:
80 break; 80 break;
81 } 81 }
82 } 82 }
83 BookmarkContextMenuControllerViews::ExecuteCommand(id); 83 BookmarkContextMenuControllerViews::ExecuteCommand(id);
84 } 84 }
85 85
86 bool BookmarkContextMenuControllerViewsWin::IsCommandEnabled(int id) const { 86 bool BookmarkContextMenuControllerViewsWin::IsCommandEnabled(int id) const {
87 // In Windows 8 metro mode no new window option on a regular chrome window 87 // In Windows 8 metro mode no new window option on a regular chrome window
88 // and no new incognito window option on an incognito chrome window. 88 // and no new incognito window option on an incognito chrome window.
89 if (base::win::GetMetroModule()) { 89 if (base::win::IsMetroProcess()) {
90 if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW && 90 if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW &&
91 !profile()->IsOffTheRecord()) { 91 !profile()->IsOffTheRecord()) {
92 return false; 92 return false;
93 } else if (id == IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO && 93 } else if (id == IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO &&
94 profile()->IsOffTheRecord()) { 94 profile()->IsOffTheRecord()) {
95 return false; 95 return false;
96 } 96 }
97 } 97 }
98 return BookmarkContextMenuControllerViews::IsCommandEnabled(id); 98 return BookmarkContextMenuControllerViews::IsCommandEnabled(id);
99 } 99 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | chrome/browser/ui/views/frame/browser_frame_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698