OLD | NEW |
1 // Copyright (c) 2009 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/search_engine_list_model.h" | 5 #import "chrome/browser/ui/cocoa/search_engine_list_model.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "chrome/browser/search_engines/template_url.h" | 8 #include "chrome/browser/search_engines/template_url.h" |
9 #include "chrome/browser/search_engines/template_url_model.h" | 9 #include "chrome/browser/search_engines/template_url_model.h" |
10 #include "chrome/browser/search_engines/template_url_model_observer.h" | 10 #include "chrome/browser/search_engines/template_url_model_observer.h" |
11 | 11 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Walks the model and builds an array of NSStrings to display to the user. | 73 // Walks the model and builds an array of NSStrings to display to the user. |
74 // Assumes there is a non-NULL model. | 74 // Assumes there is a non-NULL model. |
75 - (void)buildEngineList { | 75 - (void)buildEngineList { |
76 scoped_nsobject<NSMutableArray> engines([[NSMutableArray alloc] init]); | 76 scoped_nsobject<NSMutableArray> engines([[NSMutableArray alloc] init]); |
77 | 77 |
78 typedef std::vector<const TemplateURL*> TemplateURLs; | 78 typedef std::vector<const TemplateURL*> TemplateURLs; |
79 TemplateURLs modelURLs = model_->GetTemplateURLs(); | 79 TemplateURLs modelURLs = model_->GetTemplateURLs(); |
80 for (size_t i = 0; i < modelURLs.size(); ++i) { | 80 for (size_t i = 0; i < modelURLs.size(); ++i) { |
81 if (modelURLs[i]->ShowInDefaultList()) | 81 if (modelURLs[i]->ShowInDefaultList()) |
82 [engines addObject:base::SysWideToNSString(modelURLs[i]->short_name())]; | 82 [engines addObject:base::SysUTF16ToNSString(modelURLs[i]->short_name())]; |
83 } | 83 } |
84 | 84 |
85 [self setSearchEngines:engines.get()]; | 85 [self setSearchEngines:engines.get()]; |
86 } | 86 } |
87 | 87 |
88 // The index into |-searchEngines| of the current default search engine. | 88 // The index into |-searchEngines| of the current default search engine. |
89 // -1 if there is no default. | 89 // -1 if there is no default. |
90 - (NSInteger)defaultIndex { | 90 - (NSInteger)defaultIndex { |
91 if (!model_) return -1; | 91 if (!model_) return -1; |
92 | 92 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 DCHECK(false); | 128 DCHECK(false); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 // Return TRUE if the default is managed via policy. | 132 // Return TRUE if the default is managed via policy. |
133 - (BOOL)isDefaultManaged { | 133 - (BOOL)isDefaultManaged { |
134 return model_->is_default_search_managed(); | 134 return model_->is_default_search_managed(); |
135 } | 135 } |
136 @end | 136 @end |
OLD | NEW |