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" |
11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
12 #include "chrome/browser/autocomplete/autocomplete_input.h" | 12 #include "chrome/browser/autocomplete/autocomplete_input.h" |
13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" |
14 #include "chrome/browser/google/google_util.h" | 14 #include "chrome/browser/google/google_util.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
17 #include "chrome/browser/ssl/ssl_error_info.h" | 17 #include "chrome/browser/ssl/ssl_error_info.h" |
18 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" | 18 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "content/public/browser/cert_store.h" | 23 #include "content/public/browser/cert_store.h" |
24 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
25 #include "content/public/browser/navigation_entry.h" | 25 #include "content/public/browser/navigation_entry.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
28 #include "content/public/common/content_constants.h" | 28 #include "content/public/common/content_constants.h" |
29 #include "content/public/common/ssl_status.h" | 29 #include "content/public/common/ssl_status.h" |
30 #include "extensions/common/constants.h" | |
31 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
32 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
33 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
34 #include "net/cert/cert_status_flags.h" | 33 #include "net/cert/cert_status_flags.h" |
35 #include "net/cert/x509_certificate.h" | 34 #include "net/cert/x509_certificate.h" |
36 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
37 | 36 |
38 using content::NavigationController; | 37 using content::NavigationController; |
39 using content::NavigationEntry; | 38 using content::NavigationEntry; |
40 using content::SSLStatus; | 39 using content::SSLStatus; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 160 } |
162 | 161 |
163 GURL url = entry->GetURL(); | 162 GURL url = entry->GetURL(); |
164 GURL virtual_url = entry->GetVirtualURL(); | 163 GURL virtual_url = entry->GetVirtualURL(); |
165 if (url.SchemeIs(chrome::kChromeUIScheme) || | 164 if (url.SchemeIs(chrome::kChromeUIScheme) || |
166 virtual_url.SchemeIs(chrome::kChromeUIScheme)) { | 165 virtual_url.SchemeIs(chrome::kChromeUIScheme)) { |
167 if (!url.SchemeIs(chrome::kChromeUIScheme)) | 166 if (!url.SchemeIs(chrome::kChromeUIScheme)) |
168 url = virtual_url; | 167 url = virtual_url; |
169 return url.host() != chrome::kChromeUINewTabHost; | 168 return url.host() != chrome::kChromeUINewTabHost; |
170 } | 169 } |
171 | |
172 if (url.SchemeIs(extensions::kExtensionScheme)) | |
173 return false; | |
174 } | 170 } |
175 | 171 |
176 if (chrome::IsInstantNTP(delegate_->GetActiveWebContents())) | 172 if (chrome::IsInstantNTP(delegate_->GetActiveWebContents())) |
177 return false; | 173 return false; |
178 | 174 |
179 return true; | 175 return true; |
180 } | 176 } |
181 | 177 |
182 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const { | 178 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const { |
183 if (input_in_progress_) // When editing, assume no security style. | 179 if (input_in_progress_) // When editing, assume no security style. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 Profile* profile = | 257 Profile* profile = |
262 Profile::FromBrowserContext(contents->GetBrowserContext()); | 258 Profile::FromBrowserContext(contents->GetBrowserContext()); |
263 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( | 259 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( |
264 search_terms, false, false, &match, NULL); | 260 search_terms, false, false, &match, NULL); |
265 if (!AutocompleteMatch::IsSearchType(match.type)) | 261 if (!AutocompleteMatch::IsSearchType(match.type)) |
266 search_terms.clear(); | 262 search_terms.clear(); |
267 } | 263 } |
268 | 264 |
269 return search_terms; | 265 return search_terms; |
270 } | 266 } |
OLD | NEW |