OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/plugin_data_remover_impl.h" | 5 #include "content/browser/plugin_data_remover_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 // Called when a timeout happens in order not to block the client | 117 // Called when a timeout happens in order not to block the client |
118 // indefinitely. | 118 // indefinitely. |
119 void OnTimeout() { | 119 void OnTimeout() { |
120 LOG_IF(ERROR, is_removing_) << "Timed out"; | 120 LOG_IF(ERROR, is_removing_) << "Timed out"; |
121 SignalDone(); | 121 SignalDone(); |
122 } | 122 } |
123 | 123 |
124 // PluginProcessHost::Client methods. | 124 // PluginProcessHost::Client methods. |
125 virtual int ID() override { | 125 int ID() override { |
126 // Generate a unique identifier for this PluginProcessHostClient. | 126 // Generate a unique identifier for this PluginProcessHostClient. |
127 return ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 127 return ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
128 } | 128 } |
129 | 129 |
130 virtual bool OffTheRecord() override { | 130 bool OffTheRecord() override { return false; } |
131 return false; | |
132 } | |
133 | 131 |
134 virtual ResourceContext* GetResourceContext() override { | 132 ResourceContext* GetResourceContext() override { return resource_context_; } |
135 return resource_context_; | |
136 } | |
137 | 133 |
138 virtual void SetPluginInfo(const WebPluginInfo& info) override {} | 134 void SetPluginInfo(const WebPluginInfo& info) override {} |
139 | 135 |
140 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) override {} | 136 void OnFoundPluginProcessHost(PluginProcessHost* host) override {} |
141 | 137 |
142 virtual void OnSentPluginChannelRequest() override {} | 138 void OnSentPluginChannelRequest() override {} |
143 | 139 |
144 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) override { | 140 void OnChannelOpened(const IPC::ChannelHandle& handle) override { |
145 ConnectToChannel(handle, false); | 141 ConnectToChannel(handle, false); |
146 // Balancing the AddRef call. | 142 // Balancing the AddRef call. |
147 Release(); | 143 Release(); |
148 } | 144 } |
149 | 145 |
150 virtual void OnError() override { | 146 void OnError() override { |
151 LOG(ERROR) << "Couldn't open plugin channel"; | 147 LOG(ERROR) << "Couldn't open plugin channel"; |
152 SignalDone(); | 148 SignalDone(); |
153 // Balancing the AddRef call. | 149 // Balancing the AddRef call. |
154 Release(); | 150 Release(); |
155 } | 151 } |
156 | 152 |
157 // PpapiPluginProcessHost::BrokerClient implementation. | 153 // PpapiPluginProcessHost::BrokerClient implementation. |
158 virtual void GetPpapiChannelInfo(base::ProcessHandle* renderer_handle, | 154 void GetPpapiChannelInfo(base::ProcessHandle* renderer_handle, |
159 int* renderer_id) override { | 155 int* renderer_id) override { |
160 *renderer_handle = base::kNullProcessHandle; | 156 *renderer_handle = base::kNullProcessHandle; |
161 *renderer_id = 0; | 157 *renderer_id = 0; |
162 } | 158 } |
163 | 159 |
164 virtual void OnPpapiChannelOpened( | 160 void OnPpapiChannelOpened(const IPC::ChannelHandle& channel_handle, |
165 const IPC::ChannelHandle& channel_handle, | 161 base::ProcessId /* peer_pid */, |
166 base::ProcessId /* peer_pid */, | 162 int /* child_id */) override { |
167 int /* child_id */) override { | |
168 if (!channel_handle.name.empty()) | 163 if (!channel_handle.name.empty()) |
169 ConnectToChannel(channel_handle, true); | 164 ConnectToChannel(channel_handle, true); |
170 | 165 |
171 // Balancing the AddRef call. | 166 // Balancing the AddRef call. |
172 Release(); | 167 Release(); |
173 } | 168 } |
174 | 169 |
175 // IPC::Listener methods. | 170 // IPC::Listener methods. |
176 virtual bool OnMessageReceived(const IPC::Message& message) override { | 171 bool OnMessageReceived(const IPC::Message& message) override { |
177 IPC_BEGIN_MESSAGE_MAP(Context, message) | 172 IPC_BEGIN_MESSAGE_MAP(Context, message) |
178 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ClearSiteDataResult, | 173 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ClearSiteDataResult, |
179 OnClearSiteDataResult) | 174 OnClearSiteDataResult) |
180 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, | 175 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, |
181 OnPpapiClearSiteDataResult) | 176 OnPpapiClearSiteDataResult) |
182 IPC_MESSAGE_UNHANDLED_ERROR() | 177 IPC_MESSAGE_UNHANDLED_ERROR() |
183 IPC_END_MESSAGE_MAP() | 178 IPC_END_MESSAGE_MAP() |
184 | 179 |
185 return true; | 180 return true; |
186 } | 181 } |
187 | 182 |
188 virtual void OnChannelError() override { | 183 void OnChannelError() override { |
189 if (is_removing_) { | 184 if (is_removing_) { |
190 NOTREACHED() << "Channel error"; | 185 NOTREACHED() << "Channel error"; |
191 SignalDone(); | 186 SignalDone(); |
192 } | 187 } |
193 } | 188 } |
194 | 189 |
195 base::WaitableEvent* event() { return event_.get(); } | 190 base::WaitableEvent* event() { return event_.get(); } |
196 | 191 |
197 private: | 192 private: |
198 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 193 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
199 friend class base::DeleteHelper<Context>; | 194 friend class base::DeleteHelper<Context>; |
200 virtual ~Context() {} | 195 ~Context() override {} |
201 | 196 |
202 IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) { | 197 IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) { |
203 base::FilePath profile_path = | 198 base::FilePath profile_path = |
204 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_); | 199 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_); |
205 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc | 200 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc |
206 // (which prepends the plugin name to the relative part of the path | 201 // (which prepends the plugin name to the relative part of the path |
207 // instead, with the absolute, profile-dependent part being enforced by | 202 // instead, with the absolute, profile-dependent part being enforced by |
208 // the browser). | 203 // the browser). |
209 #if defined(OS_WIN) | 204 #if defined(OS_WIN) |
210 base::FilePath plugin_data_path = | 205 base::FilePath plugin_data_path = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 304 |
310 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 305 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
311 base::Time begin_time) { | 306 base::Time begin_time) { |
312 DCHECK(!context_.get()); | 307 DCHECK(!context_.get()); |
313 context_ = new Context(begin_time, browser_context_); | 308 context_ = new Context(begin_time, browser_context_); |
314 context_->Init(mime_type_); | 309 context_->Init(mime_type_); |
315 return context_->event(); | 310 return context_->event(); |
316 } | 311 } |
317 | 312 |
318 } // namespace content | 313 } // namespace content |
OLD | NEW |