| OLD | NEW |
| 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/ui/cocoa/edit_search_engine_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac_util.h" | 10 #import "base/mac/mac_util.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
| 13 #include "chrome/browser/search_engines/template_url.h" | 13 #include "chrome/browser/search_engines/template_url.h" |
| 14 #include "grit/app_resources.h" | 14 #include "grit/app_resources.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
| 17 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 17 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 void ShiftOriginY(NSView* view, CGFloat amount) { | 21 void ShiftOriginY(NSView* view, CGFloat amount) { |
| 22 NSPoint origin = [view frame].origin; | 22 NSPoint origin = [view frame].origin; |
| 23 origin.y += amount; | 23 origin.y += amount; |
| 24 [view setFrameOrigin:origin]; | 24 [view setFrameOrigin:origin]; |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 @implementation EditSearchEngineCocoaController | 29 @implementation EditSearchEngineCocoaController |
| 30 | 30 |
| 31 - (id)initWithProfile:(Profile*)profile | 31 - (id)initWithProfile:(Profile*)profile |
| 32 delegate:(EditSearchEngineControllerDelegate*)delegate | 32 delegate:(EditSearchEngineControllerDelegate*)delegate |
| 33 templateURL:(const TemplateURL*)url { | 33 templateURL:(const TemplateURL*)url { |
| 34 DCHECK(profile); | 34 DCHECK(profile); |
| 35 NSString* nibpath = [mac_util::MainAppBundle() | 35 NSString* nibpath = [base::mac::MainAppBundle() |
| 36 pathForResource:@"EditSearchEngine" | 36 pathForResource:@"EditSearchEngine" |
| 37 ofType:@"nib"]; | 37 ofType:@"nib"]; |
| 38 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 38 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
| 39 profile_ = profile; | 39 profile_ = profile; |
| 40 templateURL_ = url; | 40 templateURL_ = url; |
| 41 controller_.reset( | 41 controller_.reset( |
| 42 new EditSearchEngineController(templateURL_, delegate, profile_)); | 42 new EditSearchEngineController(templateURL_, delegate, profile_)); |
| 43 } | 43 } |
| 44 return self; | 44 return self; |
| 45 } | 45 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 toolTip:IDS_SEARCH_ENGINES_INVALID_URL_TT | 178 toolTip:IDS_SEARCH_ENGINES_INVALID_URL_TT |
| 179 forImageView:urlImage_ | 179 forImageView:urlImage_ |
| 180 textField:urlField_]; | 180 textField:urlField_]; |
| 181 | 181 |
| 182 BOOL isValid = (titleValid && keywordValid && urlValid); | 182 BOOL isValid = (titleValid && keywordValid && urlValid); |
| 183 [doneButton_ setEnabled:isValid]; | 183 [doneButton_ setEnabled:isValid]; |
| 184 return isValid; | 184 return isValid; |
| 185 } | 185 } |
| 186 | 186 |
| 187 @end | 187 @end |
| OLD | NEW |