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

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

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 #include "chrome/common/pref_service.h" 39 #include "chrome/common/pref_service.h"
40 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
41 #include "chrome/installer/util/google_update_settings.h" 41 #include "chrome/installer/util/google_update_settings.h"
42 #include "grit/chromium_strings.h" 42 #include "grit/chromium_strings.h"
43 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
44 #include "grit/locale_settings.h" 44 #include "grit/locale_settings.h"
45 #include "net/base/cookie_policy.h" 45 #include "net/base/cookie_policy.h"
46 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 46 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
47 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" 47 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
48 48
49 NSString* const kUserDoneEditingPrefsNotification =
50 @"kUserDoneEditingPrefsNotification";
51
52 namespace { 49 namespace {
53 50
54 std::wstring GetNewTabUIURLString() { 51 std::wstring GetNewTabUIURLString() {
55 std::wstring temp = UTF8ToWide(chrome::kChromeUINewTabURL); 52 std::wstring temp = UTF8ToWide(chrome::kChromeUINewTabURL);
56 return URLFixerUpper::FixupURL(temp, std::wstring()); 53 return URLFixerUpper::FixupURL(temp, std::wstring());
57 } 54 }
58 55
59 // Helper to remove all but the last view from the view heirarchy. 56 // Helper to remove all but the last view from the view heirarchy.
60 void RemoveAllButLastView(NSArray* views) { 57 void RemoveAllButLastView(NSArray* views) {
61 NSArray* toRemove = [views subarrayWithRange:NSMakeRange(0, [views count]-1)]; 58 NSArray* toRemove = [views subarrayWithRange:NSMakeRange(0, [views count]-1)];
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 // is done editing preferences. Make sure there are no pending field editors 1611 // is done editing preferences. Make sure there are no pending field editors
1615 // by clearing the first responder. 1612 // by clearing the first responder.
1616 - (void)windowWillClose:(NSNotification*)notification { 1613 - (void)windowWillClose:(NSNotification*)notification {
1617 // Setting the first responder to the window ends any in-progress field 1614 // Setting the first responder to the window ends any in-progress field
1618 // editor. This will update the model appropriately so there's nothing left 1615 // editor. This will update the model appropriately so there's nothing left
1619 // to do. 1616 // to do.
1620 if (![[self window] makeFirstResponder:[self window]]) { 1617 if (![[self window] makeFirstResponder:[self window]]) {
1621 // We've hit a recalcitrant field editor, force it to go away. 1618 // We've hit a recalcitrant field editor, force it to go away.
1622 [[self window] endEditingFor:nil]; 1619 [[self window] endEditingFor:nil];
1623 } 1620 }
1624 1621 [self autorelease];
1625 [[NSNotificationCenter defaultCenter]
1626 postNotificationName:kUserDoneEditingPrefsNotification
1627 object:self];
1628 } 1622 }
1629 1623
1630 - (void)controlTextDidEndEditing:(NSNotification*)notification { 1624 - (void)controlTextDidEndEditing:(NSNotification*)notification {
1631 [customPagesSource_ validateURLs]; 1625 [customPagesSource_ validateURLs];
1632 } 1626 }
1633 1627
1634 @end 1628 @end
1635 1629
1636 @implementation PreferencesWindowController(Testing) 1630 @implementation PreferencesWindowController(Testing)
1637 1631
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 case OPTIONS_PAGE_ADVANCED: 1702 case OPTIONS_PAGE_ADVANCED:
1709 return underTheHoodView_; 1703 return underTheHoodView_;
1710 case OPTIONS_PAGE_DEFAULT: 1704 case OPTIONS_PAGE_DEFAULT:
1711 case OPTIONS_PAGE_COUNT: 1705 case OPTIONS_PAGE_COUNT:
1712 LOG(DFATAL) << "Invalid page value " << page; 1706 LOG(DFATAL) << "Invalid page value " << page;
1713 } 1707 }
1714 return basicsView_; 1708 return basicsView_;
1715 } 1709 }
1716 1710
1717 @end 1711 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/preferences_window_controller.h ('k') | chrome/browser/cocoa/preferences_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698