Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 1320005: Adds GeolocationContentSettings on TabContents. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 1304
1305 return new_contents; 1305 return new_contents;
1306 } 1306 }
1307 1307
1308 // Resets the |content_blocked_| array. 1308 // Resets the |content_blocked_| array.
1309 void TabContents::ClearBlockedContentSettings() { 1309 void TabContents::ClearBlockedContentSettings() {
1310 for (size_t i = 0; i < arraysize(content_blocked_); ++i) 1310 for (size_t i = 0; i < arraysize(content_blocked_); ++i)
1311 content_blocked_[i] = false; 1311 content_blocked_[i] = false;
1312 } 1312 }
1313 1313
1314 // Resets the |geolocation_settings_| map.
1315 void TabContents::ClearGeolocationContentSettings() {
1316 geolocation_content_settings_.clear();
1317 }
1318
1314 // Notifies the RenderWidgetHost instance about the fact that the page is 1319 // Notifies the RenderWidgetHost instance about the fact that the page is
1315 // loading, or done loading and calls the base implementation. 1320 // loading, or done loading and calls the base implementation.
1316 void TabContents::SetIsLoading(bool is_loading, 1321 void TabContents::SetIsLoading(bool is_loading,
1317 LoadNotificationDetails* details) { 1322 LoadNotificationDetails* details) {
1318 if (is_loading == is_loading_) 1323 if (is_loading == is_loading_)
1319 return; 1324 return;
1320 1325
1321 if (!is_loading) { 1326 if (!is_loading) {
1322 load_state_ = net::LOAD_STATE_IDLE; 1327 load_state_ = net::LOAD_STATE_IDLE;
1323 load_state_host_.clear(); 1328 load_state_host_.clear();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 1496
1492 // Close blocked popups. 1497 // Close blocked popups.
1493 if (blocked_popups_) { 1498 if (blocked_popups_) {
1494 AutoReset auto_reset(&dont_notify_render_view_, true); 1499 AutoReset auto_reset(&dont_notify_render_view_, true);
1495 blocked_popups_->Destroy(); 1500 blocked_popups_->Destroy();
1496 blocked_popups_ = NULL; 1501 blocked_popups_ = NULL;
1497 } 1502 }
1498 1503
1499 // Clear "blocked" flags. 1504 // Clear "blocked" flags.
1500 ClearBlockedContentSettings(); 1505 ClearBlockedContentSettings();
1506 ClearGeolocationContentSettings();
1501 if (delegate_) 1507 if (delegate_)
1502 delegate_->OnBlockedContentChange(this); 1508 delegate_->OnBlockedContentChange(this);
1503 } 1509 }
1504 1510
1505 // Close constrained windows if necessary. 1511 // Close constrained windows if necessary.
1506 if (!net::RegistryControlledDomainService::SameDomainOrHost( 1512 if (!net::RegistryControlledDomainService::SameDomainOrHost(
1507 details.previous_url, details.entry->url())) 1513 details.previous_url, details.entry->url()))
1508 CloseConstrainedWindows(); 1514 CloseConstrainedWindows();
1509 1515
1510 // Update the starred state. 1516 // Update the starred state.
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 void TabContents::DocumentLoadedInFrame() { 2028 void TabContents::DocumentLoadedInFrame() {
2023 controller_.DocumentLoadedInFrame(); 2029 controller_.DocumentLoadedInFrame();
2024 } 2030 }
2025 2031
2026 void TabContents::OnContentBlocked(ContentSettingsType type) { 2032 void TabContents::OnContentBlocked(ContentSettingsType type) {
2027 content_blocked_[type] = true; 2033 content_blocked_[type] = true;
2028 if (delegate_) 2034 if (delegate_)
2029 delegate_->OnBlockedContentChange(this); 2035 delegate_->OnBlockedContentChange(this);
2030 } 2036 }
2031 2037
2038 void TabContents::OnGeolocationPermissionSet(const GURL& requesting_origin,
2039 bool allowed) {
2040 geolocation_content_settings_[requesting_origin] =
2041 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
2042 // TODO(bulach): rename OnBlockedContentChange to OnContentSettingsChange.
2043 if (delegate_)
2044 delegate_->OnBlockedContentChange(this);
2045 }
2046
2032 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { 2047 RenderViewHostDelegate::View* TabContents::GetViewDelegate() {
2033 return view_.get(); 2048 return view_.get();
2034 } 2049 }
2035 2050
2036 RenderViewHostDelegate::RendererManagement* 2051 RenderViewHostDelegate::RendererManagement*
2037 TabContents::GetRendererManagementDelegate() { 2052 TabContents::GetRendererManagementDelegate() {
2038 return &render_manager_; 2053 return &render_manager_;
2039 } 2054 }
2040 2055
2041 RenderViewHostDelegate::BrowserIntegration* 2056 RenderViewHostDelegate::BrowserIntegration*
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 } 2905 }
2891 2906
2892 void TabContents::set_encoding(const std::string& encoding) { 2907 void TabContents::set_encoding(const std::string& encoding) {
2893 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 2908 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
2894 } 2909 }
2895 2910
2896 void TabContents::SetAppIcon(const SkBitmap& app_icon) { 2911 void TabContents::SetAppIcon(const SkBitmap& app_icon) {
2897 app_icon_ = app_icon; 2912 app_icon_ = app_icon;
2898 NotifyNavigationStateChanged(INVALIDATE_TITLE); 2913 NotifyNavigationStateChanged(INVALIDATE_TITLE);
2899 } 2914 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/test/data/geolocation/iframes_different_origin.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698