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

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

Issue 8983010: Convert WebContents to return a content::NavigationController instead of the implementation. Upda... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 11 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/browsing_data_appcache_helper.h" 12 #include "chrome/browser/browsing_data_appcache_helper.h"
13 #include "chrome/browser/browsing_data_cookie_helper.h" 13 #include "chrome/browser/browsing_data_cookie_helper.h"
14 #include "chrome/browser/browsing_data_database_helper.h" 14 #include "chrome/browser/browsing_data_database_helper.h"
15 #include "chrome/browser/browsing_data_file_system_helper.h" 15 #include "chrome/browser/browsing_data_file_system_helper.h"
16 #include "chrome/browser/browsing_data_indexed_db_helper.h" 16 #include "chrome/browser/browsing_data_indexed_db_helper.h"
17 #include "chrome/browser/browsing_data_local_storage_helper.h" 17 #include "chrome/browser/browsing_data_local_storage_helper.h"
18 #include "chrome/browser/content_settings/content_settings_details.h" 18 #include "chrome/browser/content_settings/content_settings_details.h"
19 #include "chrome/browser/content_settings/content_settings_utils.h" 19 #include "chrome/browser/content_settings/content_settings_utils.h"
20 #include "chrome/browser/content_settings/host_content_settings_map.h" 20 #include "chrome/browser/content_settings/host_content_settings_map.h"
21 #include "chrome/browser/cookies_tree_model.h" 21 #include "chrome/browser/cookies_tree_model.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/render_messages.h" 25 #include "chrome/common/render_messages.h"
26 #include "content/browser/renderer_host/render_view_host.h" 26 #include "content/browser/renderer_host/render_view_host.h"
27 #include "content/browser/renderer_host/render_view_host_delegate.h" 27 #include "content/browser/renderer_host/render_view_host_delegate.h"
28 #include "content/browser/tab_contents/navigation_controller.h" 28 #include "content/public/browser/navigation_controller.h"
29 #include "content/public/browser/navigation_details.h" 29 #include "content/public/browser/navigation_details.h"
30 #include "content/public/browser/navigation_entry.h" 30 #include "content/public/browser/navigation_entry.h"
31 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
32 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 #include "content/public/browser/web_contents_delegate.h" 33 #include "content/public/browser/web_contents_delegate.h"
34 #include "webkit/fileapi/file_system_types.h" 34 #include "webkit/fileapi/file_system_types.h"
35 35
36 using content::BrowserThread; 36 using content::BrowserThread;
37 using content::NavigationEntry; 37 using content::NavigationEntry;
38 using content::WebContents; 38 using content::WebContents;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 } 463 }
464 464
465 void TabSpecificContentSettings::Observe( 465 void TabSpecificContentSettings::Observe(
466 int type, 466 int type,
467 const content::NotificationSource& source, 467 const content::NotificationSource& source,
468 const content::NotificationDetails& details) { 468 const content::NotificationDetails& details) {
469 DCHECK(type == chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED); 469 DCHECK(type == chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED);
470 470
471 content::Details<const ContentSettingsDetails> settings_details(details); 471 content::Details<const ContentSettingsDetails> settings_details(details);
472 const NavigationController& controller = web_contents()->GetController(); 472 const content::NavigationController& controller =
473 web_contents()->GetController();
473 NavigationEntry* entry = controller.GetActiveEntry(); 474 NavigationEntry* entry = controller.GetActiveEntry();
474 GURL entry_url; 475 GURL entry_url;
475 if (entry) 476 if (entry)
476 entry_url = entry->GetURL(); 477 entry_url = entry->GetURL();
477 if (settings_details.ptr()->update_all() || 478 if (settings_details.ptr()->update_all() ||
478 // The active NavigationEntry is the URL in the URL field of a tab. 479 // The active NavigationEntry is the URL in the URL field of a tab.
479 // Currently this should be matched by the |primary_pattern|. 480 // Currently this should be matched by the |primary_pattern|.
480 settings_details.ptr()->primary_pattern().Matches(entry_url)) { 481 settings_details.ptr()->primary_pattern().Matches(entry_url)) {
481 Profile* profile = 482 Profile* profile =
482 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 483 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 return new CookiesTreeModel(cookies_->Clone(), 518 return new CookiesTreeModel(cookies_->Clone(),
518 databases_->Clone(), 519 databases_->Clone(),
519 local_storages_->Clone(), 520 local_storages_->Clone(),
520 session_storages_->Clone(), 521 session_storages_->Clone(),
521 appcaches_->Clone(), 522 appcaches_->Clone(),
522 indexed_dbs_->Clone(), 523 indexed_dbs_->Clone(),
523 file_systems_->Clone(), 524 file_systems_->Clone(),
524 NULL, 525 NULL,
525 true); 526 true);
526 } 527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698