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

Unified Diff: device/devices_app/devices_app.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/devices_app/devices_app.h ('k') | device/devices_app/devices_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/devices_app/devices_app.cc
diff --git a/device/devices_app/devices_app.cc b/device/devices_app/devices_app.cc
index eb5c01c617c8d33a1c44eef9636730a5db1945c1..29a7484b821f26b5af800b653c5be248a69daee7 100644
--- a/device/devices_app/devices_app.cc
+++ b/device/devices_app/devices_app.cc
@@ -19,7 +19,7 @@
#include "device/usb/usb_service.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/shell/public/cpp/application_connection.h"
-#include "mojo/shell/public/cpp/application_impl.h"
+#include "mojo/shell/public/cpp/shell.h"
#include "url/gurl.h"
namespace device {
@@ -75,14 +75,15 @@ class DevicesApp::USBServiceInitializer {
DISALLOW_COPY_AND_ASSIGN(USBServiceInitializer);
};
-DevicesApp::DevicesApp()
- : app_impl_(nullptr), active_device_manager_count_(0) {}
+DevicesApp::DevicesApp() : shell_(nullptr), active_device_manager_count_(0) {}
DevicesApp::~DevicesApp() {
}
-void DevicesApp::Initialize(mojo::ApplicationImpl* app) {
- app_impl_ = app;
+void DevicesApp::Initialize(mojo::Shell* shell,
+ const std::string& url,
+ uint32_t id) {
+ shell_ = shell;
service_initializer_.reset(new USBServiceInitializer);
StartIdleTimer();
}
@@ -94,7 +95,7 @@ bool DevicesApp::AcceptConnection(mojo::ApplicationConnection* connection) {
void DevicesApp::Quit() {
service_initializer_.reset();
- app_impl_ = nullptr;
+ shell_ = nullptr;
}
void DevicesApp::Create(mojo::ApplicationConnection* connection,
@@ -125,11 +126,11 @@ void DevicesApp::OnConnectionError() {
}
void DevicesApp::StartIdleTimer() {
- // Passing unretained |app_impl_| is safe here because |app_impl_| is
+ // Passing unretained |shell_| is safe here because |shell_| is
// guaranteed to outlive |this|, and the callback is canceled if |this| is
// destroyed.
- idle_timeout_callback_.Reset(base::Bind(&mojo::ApplicationImpl::Quit,
- base::Unretained(app_impl_)));
+ idle_timeout_callback_.Reset(
+ base::Bind(&mojo::Shell::Quit, base::Unretained(shell_)));
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, idle_timeout_callback_.callback(),
base::TimeDelta::FromSeconds(kIdleTimeoutInSeconds));
« no previous file with comments | « device/devices_app/devices_app.h ('k') | device/devices_app/devices_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698