| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/common/notification_details.h" | 38 #include "chrome/common/notification_details.h" |
| 39 #include "chrome/common/notification_observer.h" | 39 #include "chrome/common/notification_observer.h" |
| 40 #include "chrome/common/notification_type.h" | 40 #include "chrome/common/notification_type.h" |
| 41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/pref_service.h" | 42 #include "chrome/common/pref_service.h" |
| 43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 44 #include "chrome/installer/util/google_update_settings.h" | 44 #include "chrome/installer/util/google_update_settings.h" |
| 45 #include "grit/chromium_strings.h" | 45 #include "grit/chromium_strings.h" |
| 46 #include "grit/generated_resources.h" | 46 #include "grit/generated_resources.h" |
| 47 #include "grit/locale_settings.h" | 47 #include "grit/locale_settings.h" |
| 48 #include "net/base/cookie_policy.h" | |
| 49 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 48 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 50 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 49 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| 51 | 50 |
| 52 namespace { | 51 namespace { |
| 53 | 52 |
| 54 std::string GetNewTabUIURLString() { | 53 std::string GetNewTabUIURLString() { |
| 55 return URLFixerUpper::FixupURL(chrome::kChromeUINewTabURL, std::string()); | 54 return URLFixerUpper::FixupURL(chrome::kChromeUINewTabURL, std::string()); |
| 56 } | 55 } |
| 57 | 56 |
| 58 // Helper to remove all but the last view from the view heirarchy. | 57 // Helper to remove all but the last view from the view heirarchy. |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 metricsRecording_.SetValue(enabled); | 1463 metricsRecording_.SetValue(enabled); |
| 1465 } | 1464 } |
| 1466 | 1465 |
| 1467 // Returns the index of the cookie popup based on the preference. | 1466 // Returns the index of the cookie popup based on the preference. |
| 1468 - (NSInteger)cookieBehavior { | 1467 - (NSInteger)cookieBehavior { |
| 1469 return cookieBehavior_.GetValue(); | 1468 return cookieBehavior_.GetValue(); |
| 1470 } | 1469 } |
| 1471 | 1470 |
| 1472 // Sets the backend pref for whether or not to accept cookies based on |index|. | 1471 // Sets the backend pref for whether or not to accept cookies based on |index|. |
| 1473 - (void)setCookieBehavior:(NSInteger)index { | 1472 - (void)setCookieBehavior:(NSInteger)index { |
| 1474 net::CookiePolicy::Type policy = net::CookiePolicy::ALLOW_ALL_COOKIES; | 1473 // TODO(darin): Remove everything else related to this setter. |
| 1475 if (net::CookiePolicy::ValidType(index)) | |
| 1476 policy = net::CookiePolicy::FromInt(index); | |
| 1477 const char* kUserMetrics[] = { | |
| 1478 "Options_AllowAllCookies", | |
| 1479 "Options_BlockThirdPartyCookies", | |
| 1480 "Options_BlockAllCookies" | |
| 1481 }; | |
| 1482 DCHECK(policy >= 0 && (unsigned int)policy < arraysize(kUserMetrics)); | |
| 1483 [self recordUserAction:kUserMetrics[policy]]; | |
| 1484 cookieBehavior_.SetValue(policy); | |
| 1485 } | 1474 } |
| 1486 | 1475 |
| 1487 - (NSURL*)defaultDownloadLocation { | 1476 - (NSURL*)defaultDownloadLocation { |
| 1488 NSString* pathString = | 1477 NSString* pathString = |
| 1489 base::SysWideToNSString(defaultDownloadLocation_.GetValue()); | 1478 base::SysWideToNSString(defaultDownloadLocation_.GetValue()); |
| 1490 return [NSURL fileURLWithPath:pathString]; | 1479 return [NSURL fileURLWithPath:pathString]; |
| 1491 } | 1480 } |
| 1492 | 1481 |
| 1493 - (BOOL)askForSaveLocation { | 1482 - (BOOL)askForSaveLocation { |
| 1494 return askForSaveLocation_.GetValue(); | 1483 return askForSaveLocation_.GetValue(); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 case OPTIONS_PAGE_ADVANCED: | 1798 case OPTIONS_PAGE_ADVANCED: |
| 1810 return underTheHoodView_; | 1799 return underTheHoodView_; |
| 1811 case OPTIONS_PAGE_DEFAULT: | 1800 case OPTIONS_PAGE_DEFAULT: |
| 1812 case OPTIONS_PAGE_COUNT: | 1801 case OPTIONS_PAGE_COUNT: |
| 1813 LOG(DFATAL) << "Invalid page value " << page; | 1802 LOG(DFATAL) << "Invalid page value " << page; |
| 1814 } | 1803 } |
| 1815 return basicsView_; | 1804 return basicsView_; |
| 1816 } | 1805 } |
| 1817 | 1806 |
| 1818 @end | 1807 @end |
| OLD | NEW |