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

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

Issue 697693004: Supervised users: if history recording is off, allow incognito and deleting history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix browser_tests Created 6 years, 1 month 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/extensions/extension_toolbar_model.h" 18 #include "chrome/browser/extensions/extension_toolbar_model.h"
19 #include "chrome/browser/extensions/extension_util.h" 19 #include "chrome/browser/extensions/extension_util.h"
20 #include "chrome/browser/prefs/incognito_mode_prefs.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/search/search.h" 23 #include "chrome/browser/search/search.h"
23 #include "chrome/browser/signin/signin_manager_factory.h" 24 #include "chrome/browser/signin/signin_manager_factory.h"
24 #include "chrome/browser/signin/signin_ui_util.h" 25 #include "chrome/browser/signin/signin_ui_util.h"
25 #include "chrome/browser/task_manager/task_manager.h" 26 #include "chrome/browser/task_manager/task_manager.h"
26 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 27 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
27 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_commands.h" 29 #include "chrome/browser/ui/browser_commands.h"
29 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 511
511 // For testing. 512 // For testing.
512 WrenchMenuModel::WrenchMenuModel() 513 WrenchMenuModel::WrenchMenuModel()
513 : ui::SimpleMenuModel(this), 514 : ui::SimpleMenuModel(this),
514 provider_(NULL), 515 provider_(NULL),
515 browser_(NULL), 516 browser_(NULL),
516 tab_strip_model_(NULL) { 517 tab_strip_model_(NULL) {
517 } 518 }
518 519
519 bool WrenchMenuModel::ShouldShowNewIncognitoWindowMenuItem() { 520 bool WrenchMenuModel::ShouldShowNewIncognitoWindowMenuItem() {
520 if (browser_->profile()->IsSupervised()) 521 if (browser_->profile()->IsGuestSession())
521 return false; 522 return false;
522 523
523 return !browser_->profile()->IsGuestSession(); 524 return IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
msw 2014/11/06 19:08:03 I thought there was some older discussion to makin
Marc Treib 2014/11/07 10:16:42 Right now, this returns ENABLED for guest profiles
525 IncognitoModePrefs::DISABLED;
524 } 526 }
525 527
526 void WrenchMenuModel::Build() { 528 void WrenchMenuModel::Build() {
527 #if defined(OS_WIN) 529 #if defined(OS_WIN)
528 AddItem(IDC_VIEW_INCOMPATIBILITIES, 530 AddItem(IDC_VIEW_INCOMPATIBILITIES,
529 l10n_util::GetStringUTF16(IDS_VIEW_INCOMPATIBILITIES)); 531 l10n_util::GetStringUTF16(IDS_VIEW_INCOMPATIBILITIES));
530 EnumerateModulesModel* model = 532 EnumerateModulesModel* model =
531 EnumerateModulesModel::GetInstance(); 533 EnumerateModulesModel::GetInstance();
532 if (model->modules_to_notify_about() > 0 || 534 if (model->modules_to_notify_about() > 0 ||
533 model->confirmed_bad_modules_detected() > 0) 535 model->confirmed_bad_modules_detected() > 0)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 ->GetZoomPercent(); 785 ->GetZoomPercent();
784 } 786 }
785 zoom_label_ = l10n_util::GetStringFUTF16( 787 zoom_label_ = l10n_util::GetStringFUTF16(
786 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 788 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
787 } 789 }
788 790
789 void WrenchMenuModel::OnZoomLevelChanged( 791 void WrenchMenuModel::OnZoomLevelChanged(
790 const content::HostZoomMap::ZoomLevelChange& change) { 792 const content::HostZoomMap::ZoomLevelChange& change) {
791 UpdateZoomControls(); 793 UpdateZoomControls();
792 } 794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698