| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 bool TabContents::IsContentBlocked(ContentSettingsType content_type) const { | 615 bool TabContents::IsContentBlocked(ContentSettingsType content_type) const { |
| 616 if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) | 616 if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) |
| 617 return blocked_popups_ != NULL; | 617 return blocked_popups_ != NULL; |
| 618 | 618 |
| 619 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || | 619 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || |
| 620 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || | 620 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || |
| 621 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || | 621 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || |
| 622 content_type == CONTENT_SETTINGS_TYPE_COOKIES) | 622 content_type == CONTENT_SETTINGS_TYPE_COOKIES) |
| 623 return content_blocked_[content_type]; | 623 return content_blocked_[content_type]; |
| 624 | 624 |
| 625 // TODO(joth): remove once fully implemented. |
| 626 if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 627 return false; |
| 628 |
| 625 NOTREACHED(); | 629 NOTREACHED(); |
| 626 return false; | 630 return false; |
| 627 } | 631 } |
| 628 | 632 |
| 629 std::wstring TabContents::GetStatusText() const { | 633 std::wstring TabContents::GetStatusText() const { |
| 630 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) | 634 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) |
| 631 return std::wstring(); | 635 return std::wstring(); |
| 632 | 636 |
| 633 switch (load_state_) { | 637 switch (load_state_) { |
| 634 case net::LOAD_STATE_WAITING_FOR_CACHE: | 638 case net::LOAD_STATE_WAITING_FOR_CACHE: |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 2027 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 2024 Source<NavigationController>(&controller_), | 2028 Source<NavigationController>(&controller_), |
| 2025 Details<ProvisionalLoadDetails>(&details)); | 2029 Details<ProvisionalLoadDetails>(&details)); |
| 2026 } | 2030 } |
| 2027 | 2031 |
| 2028 void TabContents::DocumentLoadedInFrame() { | 2032 void TabContents::DocumentLoadedInFrame() { |
| 2029 controller_.DocumentLoadedInFrame(); | 2033 controller_.DocumentLoadedInFrame(); |
| 2030 } | 2034 } |
| 2031 | 2035 |
| 2032 void TabContents::OnContentBlocked(ContentSettingsType type) { | 2036 void TabContents::OnContentBlocked(ContentSettingsType type) { |
| 2037 // TODO(joth): remove once fully implemented. |
| 2038 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 2033 content_blocked_[type] = true; | 2039 content_blocked_[type] = true; |
| 2034 if (delegate_) | 2040 if (delegate_) |
| 2035 delegate_->OnBlockedContentChange(this); | 2041 delegate_->OnBlockedContentChange(this); |
| 2036 } | 2042 } |
| 2037 | 2043 |
| 2038 void TabContents::OnGeolocationPermissionSet(const GURL& requesting_origin, | 2044 void TabContents::OnGeolocationPermissionSet(const GURL& requesting_origin, |
| 2039 bool allowed) { | 2045 bool allowed) { |
| 2040 geolocation_content_settings_[requesting_origin] = | 2046 geolocation_content_settings_[requesting_origin] = |
| 2041 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 2047 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 2042 // TODO(bulach): rename OnBlockedContentChange to OnContentSettingsChange. | 2048 // TODO(bulach): rename OnBlockedContentChange to OnContentSettingsChange. |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 } | 2911 } |
| 2906 | 2912 |
| 2907 void TabContents::set_encoding(const std::string& encoding) { | 2913 void TabContents::set_encoding(const std::string& encoding) { |
| 2908 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2914 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2909 } | 2915 } |
| 2910 | 2916 |
| 2911 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 2917 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
| 2912 app_icon_ = app_icon; | 2918 app_icon_ = app_icon; |
| 2913 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2919 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
| 2914 } | 2920 } |
| OLD | NEW |