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

Unified Diff: mash/shelf/shelf_model.h

Issue 1585363002: Fork a subset of ash/shelf for use in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ui/resources dep; comment out unused constants. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mash/shelf/shelf_item_types.cc ('k') | mash/shelf/shelf_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/shelf/shelf_model.h
diff --git a/ash/shelf/shelf_model.h b/mash/shelf/shelf_model.h
similarity index 67%
copy from ash/shelf/shelf_model.h
copy to mash/shelf/shelf_model.h
index 01ab2a924accacceb25c5bf9725200f705a2c7ec..99c5767699f8abf9f412d789162036b83c9581d3 100644
--- a/ash/shelf/shelf_model.h
+++ b/mash/shelf/shelf_model.h
@@ -2,20 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_SHELF_SHELF_MODEL_H_
-#define ASH_SHELF_SHELF_MODEL_H_
+#ifndef MASH_SHELF_SHELF_MODEL_H_
+#define MASH_SHELF_SHELF_MODEL_H_
-#include "ash/ash_export.h"
-#include "ash/shelf/shelf_item_types.h"
#include "base/macros.h"
#include "base/observer_list.h"
+#include "mash/shelf/shelf_item_types.h"
+#include "mash/wm/public/interfaces/user_window_controller.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
-namespace ash {
+namespace mojo {
+class ApplicationImpl;
+}
+
+namespace mash {
+namespace shelf {
class ShelfModelObserver;
// Model used by ShelfView.
-class ASH_EXPORT ShelfModel {
+class ShelfModel : public mash::wm::mojom::UserWindowObserver {
public:
enum Status {
STATUS_NORMAL,
@@ -23,8 +29,8 @@ class ASH_EXPORT ShelfModel {
STATUS_LOADING,
};
- ShelfModel();
- ~ShelfModel();
+ explicit ShelfModel(mojo::ApplicationImpl* app);
+ ~ShelfModel() override;
// Adds a new item to the model. Returns the resulting index.
int Add(const ShelfItem& item);
@@ -80,12 +86,28 @@ class ASH_EXPORT ShelfModel {
void AddObserver(ShelfModelObserver* observer);
void RemoveObserver(ShelfModelObserver* observer);
+ // TODO(msw): Do not expose this member, used by ShelfView to FocusUserWindow.
+ mash::wm::mojom::UserWindowController* user_window_controller() const {
+ return user_window_controller_.get();
+ }
+
private:
+ // Overridden from mash::wm::mojom::UserWindowObserver:
+ void OnUserWindowObserverAdded(
+ mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) override;
+ void OnUserWindowAdded(mash::wm::mojom::UserWindowPtr user_window) override;
+ void OnUserWindowRemoved(uint32_t window_id) override;
+ void OnUserWindowTitleChanged(uint32_t window_id,
+ const mojo::String& window_title) override;
+
// Makes sure |index| is in line with the type-based order of items. If that
// is not the case, adjusts index by shifting it to the valid range and
// returns the new value.
int ValidateInsertionIndex(ShelfItemType type, int index) const;
+ // Return the index of the item by window id.
+ int ItemIndexByWindowID(uint32_t window_id) const;
+
// ID assigned to the next item.
ShelfID next_id_;
@@ -93,9 +115,13 @@ class ASH_EXPORT ShelfModel {
Status status_;
base::ObserverList<ShelfModelObserver> observers_;
+ mash::wm::mojom::UserWindowControllerPtr user_window_controller_;
+ mojo::Binding<mash::wm::mojom::UserWindowObserver> binding_;
+
DISALLOW_COPY_AND_ASSIGN(ShelfModel);
};
-} // namespace ash
+} // namespace shelf
+} // namespace mash
-#endif // ASH_SHELF_SHELF_MODEL_H_
+#endif // MASH_SHELF_SHELF_MODEL_H_
« no previous file with comments | « mash/shelf/shelf_item_types.cc ('k') | mash/shelf/shelf_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698