Skip to content

Commit

Permalink
Migrate content/browser/ppapi_plugin_process_host.cc to use NetworkCh…
Browse files Browse the repository at this point in the history
…angeObserver

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=780468
Change-Id: I68acba99dbeeb5e14422718efcc14a9ab1bdd919
Reviewed-on: https://chromium-review.googlesource.com/752557
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513907}
  • Loading branch information
thatjiaozi authored and Commit Bot committed Nov 3, 2017
1 parent 9c7f857 commit b93d91d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ Joshua Lock <joshua.lock@intel.com>
Joshua Roesslein <jroesslein@gmail.com>
Josué Ratelle <jorat1346@gmail.com>
Josyula Venkat Narasimham <venkat.nj@samsung.com>
Juan Jose Lopez Jaimez <jj.lopezjaimez@gmail.com>
Juhui Lee <juhui24.lee@samsung.com>
Julien Brianceau <jbriance@cisco.com>
Julien Isorce <j.isorce@samsung.com>
Expand Down
23 changes: 4 additions & 19 deletions content/browser/ppapi_plugin_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,33 +134,18 @@ class PpapiPluginSandboxedProcessLauncherDelegate
};

class PpapiPluginProcessHost::PluginNetworkObserver
: public net::NetworkChangeNotifier::IPAddressObserver,
public net::NetworkChangeNotifier::ConnectionTypeObserver {
: public net::NetworkChangeNotifier::NetworkChangeObserver {
public:
explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host)
: process_host_(process_host) {
net::NetworkChangeNotifier::AddIPAddressObserver(this);
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
}

~PluginNetworkObserver() override {
net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
}

// IPAddressObserver implementation.
void OnIPAddressChanged() override {
// TODO(brettw) bug 90246: This doesn't seem correct. The online/offline
// notification seems like it should be sufficient, but I don't see that
// when I unplug and replug my network cable. Sending this notification when
// "something" changes seems to make Flash reasonably happy, but seems
// wrong. We should really be able to provide the real online state in
// OnConnectionTypeChanged().
process_host_->Send(new PpapiMsg_SetNetworkState(true));
}

// ConnectionTypeObserver implementation.
void OnConnectionTypeChanged(
void OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) override {
process_host_->Send(new PpapiMsg_SetNetworkState(
type != net::NetworkChangeNotifier::CONNECTION_NONE));
Expand Down

0 comments on commit b93d91d

Please sign in to comment.