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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/content_settings/tab_specific_content_settings.h" 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 29 matching lines...) Expand all
40 appcaches_->empty() && 40 appcaches_->empty() &&
41 databases_->empty() && 41 databases_->empty() &&
42 file_systems_->empty() && 42 file_systems_->empty() &&
43 indexed_dbs_->empty() && 43 indexed_dbs_->empty() &&
44 local_storages_->empty() && 44 local_storages_->empty() &&
45 session_storages_->empty(); 45 session_storages_->empty();
46 } 46 }
47 47
48 TabSpecificContentSettings::TabSpecificContentSettings(TabContents* tab) 48 TabSpecificContentSettings::TabSpecificContentSettings(TabContents* tab)
49 : TabContentsObserver(tab), 49 : TabContentsObserver(tab),
50 allowed_local_shared_objects_(tab->profile()), 50 profile_(static_cast<Profile*>(tab->browser_context())),
51 blocked_local_shared_objects_(tab->profile()), 51 allowed_local_shared_objects_(profile_),
52 geolocation_settings_state_(tab->profile()), 52 blocked_local_shared_objects_(profile_),
53 geolocation_settings_state_(profile_),
53 load_plugins_link_enabled_(true) { 54 load_plugins_link_enabled_(true) {
54 ClearBlockedContentSettingsExceptForCookies(); 55 ClearBlockedContentSettingsExceptForCookies();
55 ClearCookieSpecificContentSettings(); 56 ClearCookieSpecificContentSettings();
56 g_tab_specific.Get().push_back(this); 57 g_tab_specific.Get().push_back(this);
57 58
58 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, 59 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
59 Source<HostContentSettingsMap>( 60 Source<HostContentSettingsMap>(
60 tab->profile()->GetHostContentSettingsMap())); 61 profile_->GetHostContentSettingsMap()));
61 } 62 }
62 63
63 TabSpecificContentSettings::~TabSpecificContentSettings() { 64 TabSpecificContentSettings::~TabSpecificContentSettings() {
64 g_tab_specific.Get().remove(this); 65 g_tab_specific.Get().remove(this);
65 } 66 }
66 67
67 TabSpecificContentSettings* TabSpecificContentSettings::Get( 68 TabSpecificContentSettings* TabSpecificContentSettings::Get(
68 int render_process_id, int render_view_id) { 69 int render_process_id, int render_view_id) {
69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
70 RenderViewHost* view = RenderViewHost::FromID( 71 RenderViewHost* view = RenderViewHost::FromID(
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 const ViewHostMsg_FrameNavigate_Params& params) { 428 const ViewHostMsg_FrameNavigate_Params& params) {
428 if (!details.is_in_page) { 429 if (!details.is_in_page) {
429 // Clear "blocked" flags. 430 // Clear "blocked" flags.
430 ClearBlockedContentSettingsExceptForCookies(); 431 ClearBlockedContentSettingsExceptForCookies();
431 GeolocationDidNavigate(details); 432 GeolocationDidNavigate(details);
432 } 433 }
433 } 434 }
434 435
435 void TabSpecificContentSettings::RenderViewCreated( 436 void TabSpecificContentSettings::RenderViewCreated(
436 RenderViewHost* render_view_host) { 437 RenderViewHost* render_view_host) {
437 HostContentSettingsMap* map = 438 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap();
438 tab_contents()->profile()->GetHostContentSettingsMap();
439 render_view_host->Send(new ViewMsg_SetDefaultContentSettings( 439 render_view_host->Send(new ViewMsg_SetDefaultContentSettings(
440 map->GetDefaultContentSettings())); 440 map->GetDefaultContentSettings()));
441 } 441 }
442 442
443 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( 443 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame(
444 int64 frame_id, 444 int64 frame_id,
445 bool is_main_frame, 445 bool is_main_frame,
446 const GURL& validated_url, 446 const GURL& validated_url,
447 bool is_error_page, 447 bool is_error_page,
448 RenderViewHost* render_view_host) { 448 RenderViewHost* render_view_host) {
(...skipping 16 matching lines...) Expand all
465 Details<const ContentSettingsDetails> settings_details(details); 465 Details<const ContentSettingsDetails> settings_details(details);
466 const NavigationController& controller = tab_contents()->controller(); 466 const NavigationController& controller = tab_contents()->controller();
467 NavigationEntry* entry = controller.GetActiveEntry(); 467 NavigationEntry* entry = controller.GetActiveEntry();
468 GURL entry_url; 468 GURL entry_url;
469 if (entry) 469 if (entry)
470 entry_url = entry->url(); 470 entry_url = entry->url();
471 if (settings_details.ptr()->update_all() || 471 if (settings_details.ptr()->update_all() ||
472 // The active NavigationEntry is the URL in the URL field of a tab. 472 // The active NavigationEntry is the URL in the URL field of a tab.
473 // Currently this should be matched by the |primary_pattern|. 473 // Currently this should be matched by the |primary_pattern|.
474 settings_details.ptr()->primary_pattern().Matches(entry_url)) { 474 settings_details.ptr()->primary_pattern().Matches(entry_url)) {
475 HostContentSettingsMap* map = 475 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap();
476 tab_contents()->profile()->GetHostContentSettingsMap();
477 Send(new ViewMsg_SetDefaultContentSettings( 476 Send(new ViewMsg_SetDefaultContentSettings(
478 map->GetDefaultContentSettings())); 477 map->GetDefaultContentSettings()));
479 Send(new ViewMsg_SetContentSettingsForCurrentURL( 478 Send(new ViewMsg_SetContentSettingsForCurrentURL(
480 entry_url, map->GetContentSettings(entry_url, entry_url))); 479 entry_url, map->GetContentSettings(entry_url, entry_url)));
481 } 480 }
482 } 481 }
483 482
484 TabSpecificContentSettings::LocalSharedObjectsContainer:: 483 TabSpecificContentSettings::LocalSharedObjectsContainer::
485 LocalSharedObjectsContainer(Profile* profile) 484 LocalSharedObjectsContainer(Profile* profile)
486 : cookies_(new net::CookieMonster(NULL, NULL)), 485 : cookies_(new net::CookieMonster(NULL, NULL)),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { 517 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() {
519 return new CookiesTreeModel(cookies_, 518 return new CookiesTreeModel(cookies_,
520 databases_->Clone(), 519 databases_->Clone(),
521 local_storages_->Clone(), 520 local_storages_->Clone(),
522 session_storages_->Clone(), 521 session_storages_->Clone(),
523 appcaches_->Clone(), 522 appcaches_->Clone(),
524 indexed_dbs_->Clone(), 523 indexed_dbs_->Clone(),
525 file_systems_->Clone(), 524 file_systems_->Clone(),
526 true); 525 true);
527 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698