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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 (!bookmark_utils::CanPasteFromClipboard(node) || !can_edit)) { 1078 (!bookmark_utils::CanPasteFromClipboard(node) || !can_edit)) {
1079 return NO; 1079 return NO;
1080 } 1080 }
1081 1081
1082 if ((!can_edit) && 1082 if ((!can_edit) &&
1083 ((action == @selector(addPage:)) || 1083 ((action == @selector(addPage:)) ||
1084 (action == @selector(addFolder:)))) { 1084 (action == @selector(addFolder:)))) {
1085 return NO; 1085 return NO;
1086 } 1086 }
1087 1087
1088 Profile* profile = browser_->profile();
1088 // If this is an incognito window, don't allow "open in incognito". 1089 // If this is an incognito window, don't allow "open in incognito".
1089 if ((action == @selector(openBookmarkInIncognitoWindow:)) || 1090 if ((action == @selector(openBookmarkInIncognitoWindow:)) ||
1090 (action == @selector(openAllBookmarksIncognitoWindow:))) { 1091 (action == @selector(openAllBookmarksIncognitoWindow:))) {
1091 Profile* profile = browser_->profile();
1092 if (profile->IsOffTheRecord() || 1092 if (profile->IsOffTheRecord() ||
1093 !profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) { 1093 profile->GetPrefs()->GetInteger(prefs::kIncognitoModeAvailability) ==
1094 IncognitoModeAvailabilityPrefs::DISABLED) {
1094 return NO; 1095 return NO;
1095 } 1096 }
1096 } 1097 }
1098
1099 // If Incognito mode is forced, do not let open bookmarks in normal window.
1100 if ((action == @selector(openBookmark:)) ||
1101 (action == @selector(openAllBookmarksNewWindow:)) ||
1102 (action == @selector(openAllBookmarks:))) {
1103 if (profile->GetPrefs()->GetInteger(prefs::kIncognitoModeAvailability) ==
1104 IncognitoModeAvailabilityPrefs::FORCED) {
1105 return NO;
1106 }
1107 }
1097 1108
1098 // Enabled by default. 1109 // Enabled by default.
1099 return YES; 1110 return YES;
1100 } 1111 }
1101 1112
1102 // Actually open the URL. This is the last chance for a unit test to 1113 // Actually open the URL. This is the last chance for a unit test to
1103 // override. 1114 // override.
1104 - (void)openURL:(GURL)url disposition:(WindowOpenDisposition)disposition { 1115 - (void)openURL:(GURL)url disposition:(WindowOpenDisposition)disposition {
1105 browser_->OpenURL(url, GURL(), disposition, PageTransition::AUTO_BOOKMARK); 1116 browser_->OpenURL(url, GURL(), disposition, PageTransition::AUTO_BOOKMARK);
1106 } 1117 }
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2749 // to minimize touching the object passed in (likely a mock). 2760 // to minimize touching the object passed in (likely a mock).
2750 - (void)setButtonContextMenu:(id)menu { 2761 - (void)setButtonContextMenu:(id)menu {
2751 buttonContextMenu_ = menu; 2762 buttonContextMenu_ = menu;
2752 } 2763 }
2753 2764
2754 - (void)setIgnoreAnimations:(BOOL)ignore { 2765 - (void)setIgnoreAnimations:(BOOL)ignore {
2755 ignoreAnimations_ = ignore; 2766 ignoreAnimations_ = ignore;
2756 } 2767 }
2757 2768
2758 @end 2769 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698