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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_flash_lso_helper.cc

Issue 10790150: Show Flash LSOs for Pepper Flash in cookie dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 4 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
6
7 #include <limits>
8 #include <map>
9
10 #include "base/callback.h"
11 #include "base/logging.h"
12 #include "chrome/browser/pepper_flash_settings_manager.h"
13
14 namespace {
15
16 class BrowsingDataFlashLSOHelperImpl
markusheintz_ 2012/07/30 14:02:15 Currently there is only one implementation. Do you
Bernhard Bauer 2012/07/31 00:20:03 Right now content settings aren't hooked up yet to
17 : public BrowsingDataFlashLSOHelper,
18 public PepperFlashSettingsManager::Client {
19 public:
20 explicit BrowsingDataFlashLSOHelperImpl(
21 content::BrowserContext* browser_context);
22
23 // BrowsingDataFlashLSOHelper implementation:
24 virtual void StartFetching(const GetSitesWithDataCallback& callback) OVERRIDE;
25 virtual void DeleteFlashLSOsForSite(const std::string& site) OVERRIDE;
26
27 // PepperFlashSettingsManager::Client:
markusheintz_ 2012/07/30 14:02:15 bike shedding: "Overridden from PepperFlash..."
Bernhard Bauer 2012/07/31 00:20:03 Done.
28 virtual void OnGetSitesWithDataCompleted(
29 uint32 request_id,
30 const std::vector<std::string>& sites) OVERRIDE;
31 virtual void OnClearSiteDataCompleted(
32 uint32 request_id,
33 bool success) OVERRIDE;
34
35 private:
markusheintz_ 2012/07/30 14:02:15 Please document the attributes.
Bernhard Bauer 2012/07/31 00:20:03 Done.
36 virtual ~BrowsingDataFlashLSOHelperImpl();
37
38 PepperFlashSettingsManager settings_manager_;
39
40 uint32 get_sites_with_data_request_id_;
41
42 std::map<uint32, std::string> clear_site_data_ids_;
43
44 GetSitesWithDataCallback callback_;
markusheintz_ 2012/07/30 14:02:15 Should we initialize this to NULL?
Bernhard Bauer 2012/07/31 00:20:03 The default constructor for base::Callback already
45
46 DISALLOW_COPY_AND_ASSIGN(BrowsingDataFlashLSOHelperImpl);
47 };
48
49 BrowsingDataFlashLSOHelperImpl::BrowsingDataFlashLSOHelperImpl(
50 content::BrowserContext* browser_context)
51 : ALLOW_THIS_IN_INITIALIZER_LIST(settings_manager_(this, browser_context)),
52 get_sites_with_data_request_id_(0u) {
53 }
54
55 BrowsingDataFlashLSOHelperImpl::~BrowsingDataFlashLSOHelperImpl() {
56 }
57
58 void BrowsingDataFlashLSOHelperImpl::StartFetching(
59 const GetSitesWithDataCallback& callback) {
60 DCHECK(callback_.is_null());
61 callback_ = callback;
62 get_sites_with_data_request_id_ = settings_manager_.GetSitesWithData();
63 }
64
65 void BrowsingDataFlashLSOHelperImpl::DeleteFlashLSOsForSite(
66 const std::string& site) {
67 const uint64 kClearAllData = 0;
68 uint32 id = settings_manager_.ClearSiteData(
69 site, kClearAllData, std::numeric_limits<uint64>::max());
70 clear_site_data_ids_[id] = site;
71 }
72
73 void BrowsingDataFlashLSOHelperImpl::OnGetSitesWithDataCompleted(
74 uint32 request_id,
75 const std::vector<std::string>& sites) {
76 DCHECK_EQ(get_sites_with_data_request_id_, request_id);
77 callback_.Run(sites);
78 callback_ = GetSitesWithDataCallback();
79 }
80
81 void BrowsingDataFlashLSOHelperImpl::OnClearSiteDataCompleted(uint32 request_id,
82 bool success) {
markusheintz_ 2012/07/30 14:02:15 nit: Please fix indentation.
Bernhard Bauer 2012/07/31 00:20:03 Done.
83 std::map<uint32, std::string>::iterator entry =
84 clear_site_data_ids_.find(request_id);
85 DCHECK(entry != clear_site_data_ids_.end());
86 LOG_IF(ERROR, !success) << "Couldn't clear Flash LSO data for "
87 << entry->second;
88 clear_site_data_ids_.erase(entry);
89 }
90
91 } // namespace
92
93 // static
94 BrowsingDataFlashLSOHelper* BrowsingDataFlashLSOHelper::Create(
95 content::BrowserContext* browser_context) {
96 return new BrowsingDataFlashLSOHelperImpl(browser_context);
97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698