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

Side by Side Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 3067017: Merge 53457 - Disable proxy config button and show banner if proxy prefs are managed. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/preferences_window_controller.h" 5 #import "chrome/browser/cocoa/preferences_window_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/l10n_util_mac.h" 10 #include "app/l10n_util_mac.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 private: 410 private:
411 PreferencesWindowController* controller_; // weak, owns us 411 PreferencesWindowController* controller_; // weak, owns us
412 OptionsPage page_; // current options page 412 OptionsPage page_; // current options page
413 }; 413 };
414 414
415 } // namespace PreferencesWindowControllerInternal 415 } // namespace PreferencesWindowControllerInternal
416 416
417 @implementation PreferencesWindowController 417 @implementation PreferencesWindowController
418 418
419 @synthesize proxiesConfigureButtonEnabled = proxiesConfigureButtonEnabled_;
420
419 - (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage { 421 - (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage {
420 DCHECK(profile); 422 DCHECK(profile);
421 // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we 423 // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we
422 // can override it in a unit test. 424 // can override it in a unit test.
423 NSString* nibPath = [mac_util::MainAppBundle() 425 NSString* nibPath = [mac_util::MainAppBundle()
424 pathForResource:@"Preferences" 426 pathForResource:@"Preferences"
425 ofType:@"nib"]; 427 ofType:@"nib"];
426 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { 428 if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
427 profile_ = profile->GetOriginalProfile(); 429 profile_ = profile->GetOriginalProfile();
428 initialPage_ = initialPage; 430 initialPage_ = initialPage;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 [[NSColor colorWithDeviceRed:0xff/255.0 478 [[NSColor colorWithDeviceRed:0xff/255.0
477 green:0x9a/255.0 479 green:0x9a/255.0
478 blue:0x9a/255.0 480 blue:0x9a/255.0
479 alpha:1.0] retain]); 481 alpha:1.0] retain]);
480 482
481 // Disable the |autoFillSettingsButton_| if we have no 483 // Disable the |autoFillSettingsButton_| if we have no
482 // |personalDataManager|. 484 // |personalDataManager|.
483 PersonalDataManager* personalDataManager = 485 PersonalDataManager* personalDataManager =
484 profile_->GetPersonalDataManager(); 486 profile_->GetPersonalDataManager();
485 [autoFillSettingsButton_ setHidden:(personalDataManager == NULL)]; 487 [autoFillSettingsButton_ setHidden:(personalDataManager == NULL)];
488
489 // Initialize the proxy pref set observer.
490 proxyPrefs_.reset(
491 PrefSetObserver::CreateProxyPrefSetObserver(prefs_, observer_.get()));
492 [self setProxiesConfigureButtonEnabled:!proxyPrefs_->IsManaged()];
486 } 493 }
487 return self; 494 return self;
488 } 495 }
489 496
490 - (void)awakeFromNib { 497 - (void)awakeFromNib {
491 498
492 // Validate some assumptions in debug builds. 499 // Validate some assumptions in debug builds.
493 500
494 // "Basics", "Personal Stuff", and "Under the Hood" views should be the same 501 // "Basics", "Personal Stuff", and "Under the Hood" views should be the same
495 // width. They should be the same width so they are laid out to look as good 502 // width. They should be the same width so they are laid out to look as good
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 else if (*prefName == prefs::kEnableTranslate) { 1378 else if (*prefName == prefs::kEnableTranslate) {
1372 [self setTranslateEnabled:translateEnabled_.GetValue() ? YES : NO]; 1379 [self setTranslateEnabled:translateEnabled_.GetValue() ? YES : NO];
1373 } 1380 }
1374 else if (*prefName == prefs::kWebkitTabsToLinks) { 1381 else if (*prefName == prefs::kWebkitTabsToLinks) {
1375 [self setTabsToLinks:tabsToLinks_.GetValue() ? YES : NO]; 1382 [self setTabsToLinks:tabsToLinks_.GetValue() ? YES : NO];
1376 } 1383 }
1377 else if (*prefName == prefs::kDownloadExtensionsToOpen) { 1384 else if (*prefName == prefs::kDownloadExtensionsToOpen) {
1378 // Poke KVC. 1385 // Poke KVC.
1379 [self setFileHandlerUIEnabled:[self fileHandlerUIEnabled]]; 1386 [self setFileHandlerUIEnabled:[self fileHandlerUIEnabled]];
1380 } 1387 }
1388 else if (proxyPrefs_->IsObserved(*prefName)) {
1389 [self setProxiesConfigureButtonEnabled:!proxyPrefs_->IsManaged()];
1390 }
1381 } 1391 }
1382 1392
1383 // Set the new download path and notify the UI via KVO. 1393 // Set the new download path and notify the UI via KVO.
1384 - (void)downloadPathPanelDidEnd:(NSOpenPanel*)panel 1394 - (void)downloadPathPanelDidEnd:(NSOpenPanel*)panel
1385 code:(NSInteger)returnCode 1395 code:(NSInteger)returnCode
1386 context:(void*)context { 1396 context:(void*)context {
1387 if (returnCode == NSOKButton) { 1397 if (returnCode == NSOKButton) {
1388 [self recordUserAction:UserMetricsAction("Options_SetDownloadDirectory")]; 1398 [self recordUserAction:UserMetricsAction("Options_SetDownloadDirectory")];
1389 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item. 1399 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item.
1390 [self willChangeValueForKey:@"defaultDownloadLocation"]; 1400 [self willChangeValueForKey:@"defaultDownloadLocation"];
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 case OPTIONS_PAGE_ADVANCED: 2064 case OPTIONS_PAGE_ADVANCED:
2055 return underTheHoodView_; 2065 return underTheHoodView_;
2056 case OPTIONS_PAGE_DEFAULT: 2066 case OPTIONS_PAGE_DEFAULT:
2057 case OPTIONS_PAGE_COUNT: 2067 case OPTIONS_PAGE_COUNT:
2058 LOG(DFATAL) << "Invalid page value " << page; 2068 LOG(DFATAL) << "Invalid page value " << page;
2059 } 2069 }
2060 return basicsView_; 2070 return basicsView_;
2061 } 2071 }
2062 2072
2063 @end 2073 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/preferences_window_controller.h ('k') | chrome/browser/gtk/options/advanced_contents_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698