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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc

Issue 2059963002: Mustash implementation of ChromeLauncherController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launcher_controller_mus_5
Patch Set: Addressing feedback. Created 4 years, 6 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 | « chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc
index 1c93cc29c914bc77ab3969f2c4fb4d7d30318c8e..92fb77527374dc46cdffd6515baade3f8bc8b336 100644
--- a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc
@@ -22,8 +22,11 @@
class ChromeShelfItemDelegate : public mash::shelf::mojom::ShelfItemDelegate {
public:
- explicit ChromeShelfItemDelegate(const std::string& app_id)
- : app_id_(app_id), item_delegate_binding_(this) {}
+ explicit ChromeShelfItemDelegate(const std::string& app_id,
+ ChromeMashShelfController* controller)
+ : app_id_(app_id),
+ item_delegate_binding_(this),
+ controller_(controller) {}
~ChromeShelfItemDelegate() override {}
mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo
@@ -36,9 +39,7 @@ class ChromeShelfItemDelegate : public mash::shelf::mojom::ShelfItemDelegate {
private:
// mash::shelf::mojom::ShelfItemDelegate:
- void LaunchItem() override {
- ChromeMashShelfController::instance()->LaunchItem(app_id_);
- }
+ void LaunchItem() override { controller_->LaunchItem(app_id_); }
void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {
NOTIMPLEMENTED();
}
@@ -50,30 +51,24 @@ class ChromeShelfItemDelegate : public mash::shelf::mojom::ShelfItemDelegate {
mojo::AssociatedBinding<mash::shelf::mojom::ShelfItemDelegate>
item_delegate_binding_;
+ // Not owned.
+ ChromeMashShelfController* controller_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeShelfItemDelegate);
};
-// static
-ChromeMashShelfController* ChromeMashShelfController::instance_ = nullptr;
+ChromeMashShelfController::ChromeMashShelfController()
+ : helper_(ProfileManager::GetActiveUserProfile()),
+ observer_binding_(this) {
+ Init();
+}
ChromeMashShelfController::~ChromeMashShelfController() {}
-// static
-ChromeMashShelfController* ChromeMashShelfController::CreateInstance() {
- DCHECK(!instance_);
- instance_ = new ChromeMashShelfController();
- instance_->Init();
- return instance_;
-}
-
void ChromeMashShelfController::LaunchItem(const std::string& app_id) {
helper_.LaunchApp(app_id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE);
}
-ChromeMashShelfController::ChromeMashShelfController()
- : helper_(ProfileManager::GetActiveUserProfile()),
- observer_binding_(this) {}
-
void ChromeMashShelfController::Init() {
shell::Connector* connector =
content::MojoShellConnection::Get()->GetConnector();
@@ -128,7 +123,7 @@ void ChromeMashShelfController::PinAppsFromPrefs() {
const gfx::Image& image = rb.GetImageNamed(IDR_APP_DEFAULT_ICON);
item->image = *image.ToSkBitmap();
std::unique_ptr<ChromeShelfItemDelegate> delegate(
- new ChromeShelfItemDelegate(app));
+ new ChromeShelfItemDelegate(app, this));
shelf_controller_->PinItem(std::move(item),
delegate->CreateInterfacePtrInfoAndBind(
shelf_controller_.associated_group()));
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698