| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/geolocation/geolocation_settings_state.h" | 5 #include "chrome/browser/geolocation/geolocation_settings_state.h" |
| 6 | 6 |
| 7 #include "base/string_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 state_map_.clear(); | 37 state_map_.clear(); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 // We're in the same origin, check if there's any icon to be displayed. | 40 // We're in the same origin, check if there's any icon to be displayed. |
| 41 unsigned int tab_state_flags = 0; | 41 unsigned int tab_state_flags = 0; |
| 42 GetDetailedInfo(NULL, &tab_state_flags); | 42 GetDetailedInfo(NULL, &tab_state_flags); |
| 43 if (!(tab_state_flags & TABSTATE_HAS_ANY_ICON)) | 43 if (!(tab_state_flags & TABSTATE_HAS_ANY_ICON)) |
| 44 state_map_.clear(); | 44 state_map_.clear(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void GeolocationSettingsState::ClearStateMap() { |
| 48 state_map_.clear(); |
| 49 } |
| 50 |
| 47 void GeolocationSettingsState::GetDetailedInfo( | 51 void GeolocationSettingsState::GetDetailedInfo( |
| 48 FormattedHostsPerState* formatted_hosts_per_state, | 52 FormattedHostsPerState* formatted_hosts_per_state, |
| 49 unsigned int* tab_state_flags) const { | 53 unsigned int* tab_state_flags) const { |
| 50 DCHECK(tab_state_flags); | 54 DCHECK(tab_state_flags); |
| 51 DCHECK(embedder_url_.is_valid()); | 55 DCHECK(embedder_url_.is_valid()); |
| 52 const ContentSetting default_setting = | 56 const ContentSetting default_setting = |
| 53 profile_->GetGeolocationContentSettingsMap()->GetDefaultContentSetting(); | 57 profile_->GetGeolocationContentSettingsMap()->GetDefaultContentSetting(); |
| 54 std::set<std::string> formatted_hosts; | 58 std::set<std::string> formatted_hosts; |
| 55 std::set<std::string> repeated_formatted_hosts; | 59 std::set<std::string> repeated_formatted_hosts; |
| 56 | 60 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 94 } |
| 91 | 95 |
| 92 std::string GeolocationSettingsState::GURLToFormattedHost( | 96 std::string GeolocationSettingsState::GURLToFormattedHost( |
| 93 const GURL& url) const { | 97 const GURL& url) const { |
| 94 std::wstring display_host_wide; | 98 std::wstring display_host_wide; |
| 95 net::AppendFormattedHost( | 99 net::AppendFormattedHost( |
| 96 url, UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), | 100 url, UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), |
| 97 &display_host_wide, NULL, NULL); | 101 &display_host_wide, NULL, NULL); |
| 98 return WideToUTF8(display_host_wide); | 102 return WideToUTF8(display_host_wide); |
| 99 } | 103 } |
| OLD | NEW |