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

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 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 11 matching lines...) Expand all
22 #include "content/public/common/process_type.h" 22 #include "content/public/common/process_type.h"
23 #include "ipc/ipc_switches.h" 23 #include "ipc/ipc_switches.h"
24 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
25 #include "ppapi/proxy/ppapi_messages.h" 25 #include "ppapi/proxy/ppapi_messages.h"
26 #include "ui/base/ui_base_switches.h" 26 #include "ui/base/ui_base_switches.h"
27 #include "webkit/plugins/plugin_switches.h" 27 #include "webkit/plugins/plugin_switches.h"
28 28
29 namespace content { 29 namespace content {
30 30
31 class PpapiPluginProcessHost::PluginNetworkObserver 31 class PpapiPluginProcessHost::PluginNetworkObserver
32 : public net::NetworkChangeNotifier::IPAddressObserver, 32 : public net::NetworkChangeNotifier::NetworkChangeObserver {
33 public net::NetworkChangeNotifier::ConnectionTypeObserver {
34 public: 33 public:
35 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) 34 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host)
36 : process_host_(process_host) { 35 : process_host_(process_host) {
37 net::NetworkChangeNotifier::AddIPAddressObserver(this); 36 net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
38 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
39 } 37 }
40 38
41 ~PluginNetworkObserver() { 39 ~PluginNetworkObserver() {
42 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 40 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
43 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
44 } 41 }
45 42
46 // IPAddressObserver implementation. 43 // NetworkChangeObserver implementation.
47 virtual void OnIPAddressChanged() OVERRIDE { 44 virtual void OnNetworkChanged(
48 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline
szym 2013/01/20 06:52:08 Don't forget to add BUG=90246 to CL description.
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
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
53 // OnConnectionTypeChanged().
54 process_host_->Send(new PpapiMsg_SetNetworkState(true));
55 }
56
57 // ConnectionTypeObserver implementation.
58 virtual void OnConnectionTypeChanged(
59 net::NetworkChangeNotifier::ConnectionType type) { 45 net::NetworkChangeNotifier::ConnectionType type) {
60 process_host_->Send(new PpapiMsg_SetNetworkState( 46 process_host_->Send(new PpapiMsg_SetNetworkState(
61 type != net::NetworkChangeNotifier::CONNECTION_NONE)); 47 type != net::NetworkChangeNotifier::CONNECTION_NONE));
62 } 48 }
63 49
64 private: 50 private:
65 PpapiPluginProcessHost* const process_host_; 51 PpapiPluginProcessHost* const process_host_;
66 }; 52 };
67 53
68 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 54 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // sent_requests_ queue should be the one that the plugin just created. 355 // sent_requests_ queue should be the one that the plugin just created.
370 Client* client = sent_requests_.front(); 356 Client* client = sent_requests_.front();
371 sent_requests_.pop(); 357 sent_requests_.pop();
372 358
373 const ChildProcessData& data = process_->GetData(); 359 const ChildProcessData& data = process_->GetData();
374 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 360 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
375 data.id); 361 data.id);
376 } 362 }
377 363
378 } // namespace content 364 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698