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

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

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix Created 6 years, 6 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_editor_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 11 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
12 #include "chrome/common/net/url_fixer_upper.h"
13 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" 12 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h"
14 #include "components/bookmarks/browser/bookmark_model.h" 13 #include "components/bookmarks/browser/bookmark_model.h"
14 #include "components/url_fixer/url_fixer.h"
15 #include "components/user_prefs/user_prefs.h" 15 #include "components/user_prefs/user_prefs.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 17
18 @interface BookmarkEditorController (Private) 18 @interface BookmarkEditorController (Private)
19 19
20 // Grab the url from the text field and convert. 20 // Grab the url from the text field and convert.
21 - (GURL)GURLFromUrlField; 21 - (GURL)GURLFromUrlField;
22 22
23 @end 23 @end
24 24
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Be conservative; it is needed (e.g. "Add Page...") 94 // Be conservative; it is needed (e.g. "Add Page...")
95 node_ = NULL; 95 node_ = NULL;
96 [self cancel:self]; 96 [self cancel:self];
97 } 97 }
98 98
99 #pragma mark Bookmark Editing 99 #pragma mark Bookmark Editing
100 100
101 // If possible, return a valid GURL from the URL text field. 101 // If possible, return a valid GURL from the URL text field.
102 - (GURL)GURLFromUrlField { 102 - (GURL)GURLFromUrlField {
103 NSString* url = [self displayURL]; 103 NSString* url = [self displayURL];
104 return URLFixerUpper::FixupURL([url UTF8String], std::string()); 104 return url_fixer::FixupURL([url UTF8String], std::string());
105 } 105 }
106 106
107 // Enable the OK button if there is a valid URL. 107 // Enable the OK button if there is a valid URL.
108 - (BOOL)okEnabled { 108 - (BOOL)okEnabled {
109 BOOL okEnabled = NO; 109 BOOL okEnabled = NO;
110 if ([[self displayURL] length]) { 110 if ([[self displayURL] length]) {
111 GURL newURL = [self GURLFromUrlField]; 111 GURL newURL = [self GURLFromUrlField];
112 okEnabled = (newURL.is_valid()) ? YES : NO; 112 okEnabled = (newURL.is_valid()) ? YES : NO;
113 } 113 }
114 if (okEnabled) 114 if (okEnabled)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 SetExpandedNodes(expanded_nodes); 162 SetExpandedNodes(expanded_nodes);
163 return [NSNumber numberWithBool:YES]; 163 return [NSNumber numberWithBool:YES];
164 } 164 }
165 165
166 - (NSColor *)urlFieldColor { 166 - (NSColor *)urlFieldColor {
167 return [urlField_ backgroundColor]; 167 return [urlField_ backgroundColor];
168 } 168 }
169 169
170 @end // BookmarkEditorController 170 @end // BookmarkEditorController
171 171
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698