OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 if (entry && entry->GetURL().SchemeIs(chrome::kDriveScheme)) | 172 if (entry && entry->GetURL().SchemeIs(chrome::kDriveScheme)) |
173 return false; | 173 return false; |
174 #endif | 174 #endif |
175 | 175 |
176 if (chrome::IsInstantNTP(web_contents)) | 176 if (chrome::IsInstantNTP(web_contents)) |
177 return false; | 177 return false; |
178 | 178 |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 bool ToolbarModelImpl::ShouldGreyOutURL() const { | |
183 WebContents* web_contents = delegate_->GetActiveWebContents(); | |
184 if (web_contents && web_contents->GetWebUIForCurrentState()) | |
sky
2013/04/03 04:03:57
nit: make this a single return, eg:
return web_con
| |
185 return web_contents->GetWebUIForCurrentState()->ShouldGreyOutURL(); | |
186 return false; | |
187 } | |
188 | |
182 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const { | 189 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const { |
183 if (input_in_progress_) // When editing, assume no security style. | 190 if (input_in_progress_) // When editing, assume no security style. |
184 return NONE; | 191 return NONE; |
185 | 192 |
186 return GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); | 193 return GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); |
187 } | 194 } |
188 | 195 |
189 int ToolbarModelImpl::GetIcon() const { | 196 int ToolbarModelImpl::GetIcon() const { |
190 if (WouldReplaceSearchURLWithSearchTerms()) | 197 if (WouldReplaceSearchURLWithSearchTerms()) |
191 return IDR_OMNIBOX_SEARCH; | 198 return IDR_OMNIBOX_SEARCH; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 Profile* profile = | 268 Profile* profile = |
262 Profile::FromBrowserContext(contents->GetBrowserContext()); | 269 Profile::FromBrowserContext(contents->GetBrowserContext()); |
263 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( | 270 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( |
264 search_terms, false, false, &match, NULL); | 271 search_terms, false, false, &match, NULL); |
265 if (!AutocompleteMatch::IsSearchType(match.type)) | 272 if (!AutocompleteMatch::IsSearchType(match.type)) |
266 search_terms.clear(); | 273 search_terms.clear(); |
267 } | 274 } |
268 | 275 |
269 return search_terms; | 276 return search_terms; |
270 } | 277 } |
OLD | NEW |