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/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class PpapiPluginProcessHost::PluginNetworkObserver | 31 class PpapiPluginProcessHost::PluginNetworkObserver |
32 : public net::NetworkChangeNotifier::IPAddressObserver, | 32 : public net::NetworkChangeNotifier::IPAddressObserver, |
33 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 33 public net::NetworkChangeNotifier::ConnectionTypeObserver { |
34 public: | 34 public: |
35 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) | 35 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) |
36 : process_host_(process_host) { | 36 : process_host_(process_host) { |
37 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 37 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
38 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 38 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
39 } | 39 } |
40 | 40 |
41 ~PluginNetworkObserver() { | 41 virtual ~PluginNetworkObserver() { |
42 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 42 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
43 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 43 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
44 } | 44 } |
45 | 45 |
46 // IPAddressObserver implementation. | 46 // IPAddressObserver implementation. |
47 virtual void OnIPAddressChanged() OVERRIDE { | 47 virtual void OnIPAddressChanged() OVERRIDE { |
48 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline | 48 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline |
49 // notification seems like it should be sufficient, but I don't see that | 49 // notification seems like it should be sufficient, but I don't see that |
50 // when I unplug and replug my network cable. Sending this notification when | 50 // when I unplug and replug my network cable. Sending this notification when |
51 // "something" changes seems to make Flash reasonably happy, but seems | 51 // "something" changes seems to make Flash reasonably happy, but seems |
52 // wrong. We should really be able to provide the real online state in | 52 // wrong. We should really be able to provide the real online state in |
53 // OnConnectionTypeChanged(). | 53 // OnConnectionTypeChanged(). |
54 process_host_->Send(new PpapiMsg_SetNetworkState(true)); | 54 process_host_->Send(new PpapiMsg_SetNetworkState(true)); |
55 } | 55 } |
56 | 56 |
57 // ConnectionTypeObserver implementation. | 57 // ConnectionTypeObserver implementation. |
58 virtual void OnConnectionTypeChanged( | 58 virtual void OnConnectionTypeChanged( |
59 net::NetworkChangeNotifier::ConnectionType type) { | 59 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { |
60 process_host_->Send(new PpapiMsg_SetNetworkState( | 60 process_host_->Send(new PpapiMsg_SetNetworkState( |
61 type != net::NetworkChangeNotifier::CONNECTION_NONE)); | 61 type != net::NetworkChangeNotifier::CONNECTION_NONE)); |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 PpapiPluginProcessHost* const process_host_; | 65 PpapiPluginProcessHost* const process_host_; |
66 }; | 66 }; |
67 | 67 |
68 PpapiPluginProcessHost::~PpapiPluginProcessHost() { | 68 PpapiPluginProcessHost::~PpapiPluginProcessHost() { |
69 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") | 69 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // sent_requests_ queue should be the one that the plugin just created. | 383 // sent_requests_ queue should be the one that the plugin just created. |
384 Client* client = sent_requests_.front(); | 384 Client* client = sent_requests_.front(); |
385 sent_requests_.pop(); | 385 sent_requests_.pop(); |
386 | 386 |
387 const ChildProcessData& data = process_->GetData(); | 387 const ChildProcessData& data = process_->GetData(); |
388 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 388 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
389 data.id); | 389 data.id); |
390 } | 390 } |
391 | 391 |
392 } // namespace content | 392 } // namespace content |
OLD | NEW |