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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window.h

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: fix mac compile Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/image_decoder.h" 13 #include "chrome/browser/image_decoder.h"
14 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" 14 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
15 #include "ui/base/base_window.h" 15 #include "ui/base/base_window.h"
16 #include "ui/gfx/image/image_skia.h"
17 16
18 class ArcAppWindowLauncherController; 17 class ArcAppWindowLauncherController;
19 class ArcAppWindowLauncherItemController; 18 class ArcAppWindowLauncherItemController;
19 namespace gfx {
20 class ImageSkia;
21 }
20 22
21 namespace views { 23 namespace views {
22 class Widget; 24 class Widget;
23 } 25 }
24 26
25 // A ui::BaseWindow for a chromeos launcher to control ARC applications. 27 // A ui::BaseWindow for a chromeos launcher to control ARC applications.
26 class ArcAppWindow : public ui::BaseWindow, public ImageDecoder::ImageRequest { 28 class ArcAppWindow : public ui::BaseWindow, public ImageDecoder::ImageRequest {
27 public: 29 public:
28 // TODO(khmel): use a bool set to false by default, or use an existing enum, 30 // TODO(khmel): use a bool set to false by default, or use an existing enum,
29 // like ash::wm::WindowStateType. 31 // like ash::wm::WindowStateType.
(...skipping 26 matching lines...) Expand all
56 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; } 58 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; }
57 59
58 const ash::ShelfID& shelf_id() const { return shelf_id_; } 60 const ash::ShelfID& shelf_id() const { return shelf_id_; }
59 61
60 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; } 62 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; }
61 63
62 views::Widget* widget() const { return widget_; } 64 views::Widget* widget() const { return widget_; }
63 65
64 ArcAppWindowLauncherItemController* controller() { return controller_; } 66 ArcAppWindowLauncherItemController* controller() { return controller_; }
65 67
66 const gfx::ImageSkia& icon() const { return icon_; }
67
68 // ui::BaseWindow: 68 // ui::BaseWindow:
69 bool IsActive() const override; 69 bool IsActive() const override;
70 bool IsMaximized() const override; 70 bool IsMaximized() const override;
71 bool IsMinimized() const override; 71 bool IsMinimized() const override;
72 bool IsFullscreen() const override; 72 bool IsFullscreen() const override;
73 gfx::NativeWindow GetNativeWindow() const override; 73 gfx::NativeWindow GetNativeWindow() const override;
74 gfx::Rect GetRestoredBounds() const override; 74 gfx::Rect GetRestoredBounds() const override;
75 ui::WindowShowState GetRestoredState() const override; 75 ui::WindowShowState GetRestoredState() const override;
76 gfx::Rect GetBounds() const override; 76 gfx::Rect GetBounds() const override;
77 void Show() override; 77 void Show() override;
78 void ShowInactive() override; 78 void ShowInactive() override;
79 void Hide() override; 79 void Hide() override;
80 void Close() override; 80 void Close() override;
81 void Activate() override; 81 void Activate() override;
82 void Deactivate() override; 82 void Deactivate() override;
83 void Maximize() override; 83 void Maximize() override;
84 void Minimize() override; 84 void Minimize() override;
85 void Restore() override; 85 void Restore() override;
86 void SetBounds(const gfx::Rect& bounds) override; 86 void SetBounds(const gfx::Rect& bounds) override;
87 void FlashFrame(bool flash) override; 87 void FlashFrame(bool flash) override;
88 bool IsAlwaysOnTop() const override; 88 bool IsAlwaysOnTop() const override;
89 void SetAlwaysOnTop(bool always_on_top) override; 89 void SetAlwaysOnTop(bool always_on_top) override;
90 90
91 private: 91 private:
92 // Resets the icon and updates |controller_|'s active icon as needed. 92 // Sets the icon for the window.
93 void ResetIcon(); 93 void SetIcon(const gfx::ImageSkia& icon);
94 94
95 // ImageDecoder::ImageRequest: 95 // ImageDecoder::ImageRequest:
96 void OnImageDecoded(const SkBitmap& decoded_image) override; 96 void OnImageDecoded(const SkBitmap& decoded_image) override;
97 97
98 // Keeps associated ARC task id. 98 // Keeps associated ARC task id.
99 const int task_id_; 99 const int task_id_;
100 // Keeps ARC shelf grouping id. 100 // Keeps ARC shelf grouping id.
101 const arc::ArcAppShelfId app_shelf_id_; 101 const arc::ArcAppShelfId app_shelf_id_;
102 // Keeps shelf id. 102 // Keeps shelf id.
103 ash::ShelfID shelf_id_; 103 ash::ShelfID shelf_id_;
104 // Keeps current full-screen mode. 104 // Keeps current full-screen mode.
105 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED; 105 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
106 // Contains custom icon if it was set.
107 gfx::ImageSkia icon_;
108 // Unowned pointers 106 // Unowned pointers
109 views::Widget* const widget_; 107 views::Widget* const widget_;
110 ArcAppWindowLauncherController* const owner_; 108 ArcAppWindowLauncherController* const owner_;
111 ArcAppWindowLauncherItemController* controller_ = nullptr; 109 ArcAppWindowLauncherItemController* controller_ = nullptr;
112 110
113 DISALLOW_COPY_AND_ASSIGN(ArcAppWindow); 111 DISALLOW_COPY_AND_ASSIGN(ArcAppWindow);
114 }; 112 };
115 113
116 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_ 114 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698