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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.h" | 7 #import "chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.h" |
8 | 8 |
9 #import "base/mac_util.h" | 9 #import "base/mac/mac_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/search_engines/template_url_model.h" | 15 #include "chrome/browser/search_engines/template_url_model.h" |
16 #include "chrome/browser/search_engines/template_url_table_model.h" | 16 #include "chrome/browser/search_engines/template_url_table_model.h" |
17 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h" | 17 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h" |
18 #import "chrome/browser/ui/cocoa/window_size_autosaver.h" | 18 #import "chrome/browser/ui/cocoa/window_size_autosaver.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 KeywordEditorCocoaController* controller = | 139 KeywordEditorCocoaController* controller = |
140 [[self alloc] initWithProfile:profile]; | 140 [[self alloc] initWithProfile:profile]; |
141 it = map->insert(std::make_pair(profile, controller)).first; | 141 it = map->insert(std::make_pair(profile, controller)).first; |
142 } | 142 } |
143 | 143 |
144 [it->second showWindow:nil]; | 144 [it->second showWindow:nil]; |
145 } | 145 } |
146 | 146 |
147 - (id)initWithProfile:(Profile*)profile { | 147 - (id)initWithProfile:(Profile*)profile { |
148 DCHECK(profile); | 148 DCHECK(profile); |
149 NSString* nibpath = [mac_util::MainAppBundle() | 149 NSString* nibpath = [base::mac::MainAppBundle() |
150 pathForResource:@"KeywordEditor" | 150 pathForResource:@"KeywordEditor" |
151 ofType:@"nib"]; | 151 ofType:@"nib"]; |
152 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 152 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
153 profile_ = profile; | 153 profile_ = profile; |
154 controller_.reset(new KeywordEditorController(profile_)); | 154 controller_.reset(new KeywordEditorController(profile_)); |
155 observer_.reset(new KeywordEditorModelObserver(self)); | 155 observer_.reset(new KeywordEditorModelObserver(self)); |
156 controller_->table_model()->SetObserver(observer_.get()); | 156 controller_->table_model()->SetObserver(observer_.get()); |
157 controller_->url_model()->AddObserver(observer_.get()); | 157 controller_->url_model()->AddObserver(observer_.get()); |
158 groupCell_.reset([[NSTextFieldCell alloc] init]); | 158 groupCell_.reset([[NSTextFieldCell alloc] init]); |
159 | 159 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 controller_->table_model()->last_search_engine_index() + 1; | 416 controller_->table_model()->last_search_engine_index() + 1; |
417 DCHECK_NE(row, otherGroupId); | 417 DCHECK_NE(row, otherGroupId); |
418 if (row >= otherGroupId) { | 418 if (row >= otherGroupId) { |
419 return row - 2; // Other group. | 419 return row - 2; // Other group. |
420 } else { | 420 } else { |
421 return row - 1; // Default group. | 421 return row - 1; // Default group. |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 @end | 425 @end |
OLD | NEW |