| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_toolbar_model_delegate.h" | 5 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| 11 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 11 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "components/google/core/browser/google_util.h" | 14 #include "components/google/core/browser/google_util.h" |
| 15 #include "components/omnibox/browser/autocomplete_input.h" | 15 #include "components/omnibox/browser/autocomplete_input.h" |
| 16 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 17 #include "content/public/browser/cert_store.h" | 17 #include "content/public/browser/cert_store.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/ssl_status.h" | 21 #include "content/public/common/ssl_status.h" |
| 22 | 22 |
| 23 ChromeToolbarModelDelegate::ChromeToolbarModelDelegate() {} | 23 ChromeToolbarModelDelegate::ChromeToolbarModelDelegate() {} |
| 24 | 24 |
| 25 ChromeToolbarModelDelegate::~ChromeToolbarModelDelegate() {} | 25 ChromeToolbarModelDelegate::~ChromeToolbarModelDelegate() {} |
| 26 | 26 |
| 27 std::string ChromeToolbarModelDelegate::GetAcceptLanguages() const { | |
| 28 Profile* profile = GetProfile(); | |
| 29 return profile ? profile->GetPrefs()->GetString(prefs::kAcceptLanguages) | |
| 30 : std::string(); | |
| 31 } | |
| 32 | |
| 33 base::string16 ChromeToolbarModelDelegate::FormattedStringWithEquivalentMeaning( | 27 base::string16 ChromeToolbarModelDelegate::FormattedStringWithEquivalentMeaning( |
| 34 const GURL& url, | 28 const GURL& url, |
| 35 const base::string16& formatted_url) const { | 29 const base::string16& formatted_url) const { |
| 36 return AutocompleteInput::FormattedStringWithEquivalentMeaning( | 30 return AutocompleteInput::FormattedStringWithEquivalentMeaning( |
| 37 url, formatted_url, ChromeAutocompleteSchemeClassifier(GetProfile())); | 31 url, formatted_url, ChromeAutocompleteSchemeClassifier(GetProfile())); |
| 38 } | 32 } |
| 39 | 33 |
| 40 bool ChromeToolbarModelDelegate::GetURL(GURL* url) const { | 34 bool ChromeToolbarModelDelegate::GetURL(GURL* url) const { |
| 41 DCHECK(url); | 35 DCHECK(url); |
| 42 content::NavigationEntry* entry = GetNavigationEntry(); | 36 content::NavigationEntry* entry = GetNavigationEntry(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 content::NavigationController* controller = GetNavigationController(); | 140 content::NavigationController* controller = GetNavigationController(); |
| 147 return controller ? controller->GetVisibleEntry() : nullptr; | 141 return controller ? controller->GetVisibleEntry() : nullptr; |
| 148 } | 142 } |
| 149 | 143 |
| 150 Profile* ChromeToolbarModelDelegate::GetProfile() const { | 144 Profile* ChromeToolbarModelDelegate::GetProfile() const { |
| 151 content::NavigationController* controller = GetNavigationController(); | 145 content::NavigationController* controller = GetNavigationController(); |
| 152 return controller | 146 return controller |
| 153 ? Profile::FromBrowserContext(controller->GetBrowserContext()) | 147 ? Profile::FromBrowserContext(controller->GetBrowserContext()) |
| 154 : nullptr; | 148 : nullptr; |
| 155 } | 149 } |
| OLD | NEW |