| 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/text_elider.h" | 9 #include "app/text_elider.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 | 1302 |
| 1303 return new_contents; | 1303 return new_contents; |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 // Resets the |content_blocked_| array. | 1306 // Resets the |content_blocked_| array. |
| 1307 void TabContents::ClearBlockedContentSettings() { | 1307 void TabContents::ClearBlockedContentSettings() { |
| 1308 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | 1308 for (size_t i = 0; i < arraysize(content_blocked_); ++i) |
| 1309 content_blocked_[i] = false; | 1309 content_blocked_[i] = false; |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 // Resets the |geolocation_settings_| map. |
| 1313 void TabContents::ClearGeolocationContentSettings() { |
| 1314 geolocation_content_settings_.clear(); |
| 1315 } |
| 1316 |
| 1312 // Notifies the RenderWidgetHost instance about the fact that the page is | 1317 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 1313 // loading, or done loading and calls the base implementation. | 1318 // loading, or done loading and calls the base implementation. |
| 1314 void TabContents::SetIsLoading(bool is_loading, | 1319 void TabContents::SetIsLoading(bool is_loading, |
| 1315 LoadNotificationDetails* details) { | 1320 LoadNotificationDetails* details) { |
| 1316 if (is_loading == is_loading_) | 1321 if (is_loading == is_loading_) |
| 1317 return; | 1322 return; |
| 1318 | 1323 |
| 1319 if (!is_loading) { | 1324 if (!is_loading) { |
| 1320 load_state_ = net::LOAD_STATE_IDLE; | 1325 load_state_ = net::LOAD_STATE_IDLE; |
| 1321 load_state_host_.clear(); | 1326 load_state_host_.clear(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 | 1494 |
| 1490 // Close blocked popups. | 1495 // Close blocked popups. |
| 1491 if (blocked_popups_) { | 1496 if (blocked_popups_) { |
| 1492 AutoReset auto_reset(&dont_notify_render_view_, true); | 1497 AutoReset auto_reset(&dont_notify_render_view_, true); |
| 1493 blocked_popups_->Destroy(); | 1498 blocked_popups_->Destroy(); |
| 1494 blocked_popups_ = NULL; | 1499 blocked_popups_ = NULL; |
| 1495 } | 1500 } |
| 1496 | 1501 |
| 1497 // Clear "blocked" flags. | 1502 // Clear "blocked" flags. |
| 1498 ClearBlockedContentSettings(); | 1503 ClearBlockedContentSettings(); |
| 1504 ClearGeolocationContentSettings(); |
| 1499 if (delegate_) | 1505 if (delegate_) |
| 1500 delegate_->OnBlockedContentChange(this); | 1506 delegate_->OnBlockedContentChange(this); |
| 1501 } | 1507 } |
| 1502 | 1508 |
| 1503 // Close constrained windows if necessary. | 1509 // Close constrained windows if necessary. |
| 1504 if (!net::RegistryControlledDomainService::SameDomainOrHost( | 1510 if (!net::RegistryControlledDomainService::SameDomainOrHost( |
| 1505 details.previous_url, details.entry->url())) | 1511 details.previous_url, details.entry->url())) |
| 1506 CloseConstrainedWindows(); | 1512 CloseConstrainedWindows(); |
| 1507 | 1513 |
| 1508 // Update the starred state. | 1514 // Update the starred state. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 void TabContents::DocumentLoadedInFrame() { | 2026 void TabContents::DocumentLoadedInFrame() { |
| 2021 controller_.DocumentLoadedInFrame(); | 2027 controller_.DocumentLoadedInFrame(); |
| 2022 } | 2028 } |
| 2023 | 2029 |
| 2024 void TabContents::OnContentBlocked(ContentSettingsType type) { | 2030 void TabContents::OnContentBlocked(ContentSettingsType type) { |
| 2025 content_blocked_[type] = true; | 2031 content_blocked_[type] = true; |
| 2026 if (delegate_) | 2032 if (delegate_) |
| 2027 delegate_->OnBlockedContentChange(this); | 2033 delegate_->OnBlockedContentChange(this); |
| 2028 } | 2034 } |
| 2029 | 2035 |
| 2036 void TabContents::OnGeolocationPermissionSet(const GURL& requesting_origin, |
| 2037 bool allowed) { |
| 2038 geolocation_content_settings_[requesting_origin] = |
| 2039 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 2040 // TODO(bulach): rename OnBlockedContentChange to OnContentSettingsChange. |
| 2041 if (delegate_) |
| 2042 delegate_->OnBlockedContentChange(this); |
| 2043 } |
| 2044 |
| 2030 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 2045 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
| 2031 return view_.get(); | 2046 return view_.get(); |
| 2032 } | 2047 } |
| 2033 | 2048 |
| 2034 RenderViewHostDelegate::RendererManagement* | 2049 RenderViewHostDelegate::RendererManagement* |
| 2035 TabContents::GetRendererManagementDelegate() { | 2050 TabContents::GetRendererManagementDelegate() { |
| 2036 return &render_manager_; | 2051 return &render_manager_; |
| 2037 } | 2052 } |
| 2038 | 2053 |
| 2039 RenderViewHostDelegate::BrowserIntegration* | 2054 RenderViewHostDelegate::BrowserIntegration* |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 } | 2903 } |
| 2889 | 2904 |
| 2890 void TabContents::set_encoding(const std::string& encoding) { | 2905 void TabContents::set_encoding(const std::string& encoding) { |
| 2891 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2906 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2892 } | 2907 } |
| 2893 | 2908 |
| 2894 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 2909 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
| 2895 app_icon_ = app_icon; | 2910 app_icon_ = app_icon; |
| 2896 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2911 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
| 2897 } | 2912 } |
| OLD | NEW |