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

Side by Side Diff: chrome/browser/ui/webui/collected_cookies_ui_delegate.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: works now 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/ui/webui/collected_cookies_ui_delegate.h" 5 #include "chrome/browser/ui/webui/collected_cookies_ui_delegate.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 SendResponse(request_id, html_bytes); 131 SendResponse(request_id, html_bytes);
132 } 132 }
133 133
134 } // namespace 134 } // namespace
135 135
136 // static 136 // static
137 void CollectedCookiesUIDelegate::Show(TabContents* tab_contents) { 137 void CollectedCookiesUIDelegate::Show(TabContents* tab_contents) {
138 CollectedCookiesUIDelegate* delegate = 138 CollectedCookiesUIDelegate* delegate =
139 new CollectedCookiesUIDelegate(tab_contents); 139 new CollectedCookiesUIDelegate(tab_contents);
140 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(tab_contents->profile(), 140 Profile* profile = static_cast<Profile*>(tab_contents->context());
141 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile,
141 delegate, 142 delegate,
142 tab_contents); 143 tab_contents);
143 } 144 }
144 145
145 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( 146 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate(
146 TabContents* tab_contents) 147 TabContents* tab_contents)
147 : tab_contents_(tab_contents), 148 : tab_contents_(tab_contents),
148 closed_(false) { 149 closed_(false) {
149 TabSpecificContentSettings* content_settings = 150 TabContentsWrapper* wrapper =
150 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> 151 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
151 content_settings(); 152 TabSpecificContentSettings* content_settings = wrapper->content_settings();
152 HostContentSettingsMap* host_content_settings_map = 153 HostContentSettingsMap* host_content_settings_map =
153 tab_contents_->profile()->GetHostContentSettingsMap(); 154 wrapper->profile()->GetHostContentSettingsMap();
154 155
155 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, 156 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN,
156 Source<TabSpecificContentSettings>(content_settings)); 157 Source<TabSpecificContentSettings>(content_settings));
157 158
158 allowed_cookies_tree_model_.reset( 159 allowed_cookies_tree_model_.reset(
159 content_settings->GetAllowedCookiesTreeModel()); 160 content_settings->GetAllowedCookiesTreeModel());
160 blocked_cookies_tree_model_.reset( 161 blocked_cookies_tree_model_.reset(
161 content_settings->GetBlockedCookiesTreeModel()); 162 content_settings->GetBlockedCookiesTreeModel());
162 163
163 CollectedCookiesSource* source = new CollectedCookiesSource( 164 CollectedCookiesSource* source = new CollectedCookiesSource(
164 host_content_settings_map->BlockThirdPartyCookies()); 165 host_content_settings_map->BlockThirdPartyCookies());
165 tab_contents->profile()->GetChromeURLDataManager()->AddDataSource(source); 166 wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source);
166 } 167 }
167 168
168 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() { 169 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() {
169 } 170 }
170 171
171 bool CollectedCookiesUIDelegate::IsDialogModal() const { 172 bool CollectedCookiesUIDelegate::IsDialogModal() const {
172 return false; 173 return false;
173 } 174 }
174 175
175 std::wstring CollectedCookiesUIDelegate::GetDialogTitle() const { 176 std::wstring CollectedCookiesUIDelegate::GetDialogTitle() const {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (!args->GetString(0, &node_path)) 284 if (!args->GetString(0, &node_path))
284 return; 285 return;
285 286
286 CookieTreeOriginNode* origin_node = GetOriginNode( 287 CookieTreeOriginNode* origin_node = GetOriginNode(
287 blocked_cookies_tree_model_.get(), node_path); 288 blocked_cookies_tree_model_.get(), node_path);
288 if (!origin_node) 289 if (!origin_node)
289 return; 290 return;
290 291
291 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); 292 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY);
292 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698