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

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

Issue 2894443002: arc: Set custom icon in shelf for ARC apps. (Closed)
Patch Set: comments addressed Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "ash/public/cpp/shelf_types.h"
12 #include "base/macros.h"
13 #include "chrome/browser/image_decoder.h"
14 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
15 #include "ui/base/base_window.h"
16 #include "ui/gfx/image/image_skia.h"
17
18 class ArcAppWindowLauncherController;
19 class ArcAppWindowLauncherItemController;
20
21 namespace views {
22 class Widget;
23 }
24
25 // A ui::BaseWindow for a chromeos launcher to control ARC applications.
26 class ArcAppWindow : public ui::BaseWindow, public ImageDecoder::ImageRequest {
27 public:
28 enum class FullScreenMode {
29 NOT_DEFINED, // Fullscreen mode was not defined.
30 ACTIVE, // Fullscreen is activated for an app.
31 NON_ACTIVE, // Fullscreen was not activated for an app.
32 };
33
34 ArcAppWindow(int task_id,
35 const arc::ArcAppShelfId& app_shelf_id,
36 views::Widget* widget,
37 ArcAppWindowLauncherController* owner);
38
39 ~ArcAppWindow() override;
40
41 void SetController(ArcAppWindowLauncherItemController* controller);
42
43 void SetFullscreenMode(FullScreenMode mode);
44
45 // Sets optional window title and icon. Note that |unsafe_icon_data_png| has
46 // to be decoded in separate process for security reason.
47 void SetDescription(const std::string& title,
48 const std::vector<uint8_t>& unsafe_icon_data_png);
49
50 FullScreenMode fullscreen_mode() const { return fullscreen_mode_; }
51
52 int task_id() const { return task_id_; }
53
54 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; }
55
56 const ash::ShelfID& shelf_id() const { return shelf_id_; }
57
58 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; }
59
60 views::Widget* widget() const { return widget_; }
61
62 ArcAppWindowLauncherItemController* controller() const { return controller_; }
63
64 const gfx::ImageSkia& icon() const { return icon_; }
65
66 // ui::BaseWindow:
67 bool IsActive() const override;
68 bool IsMaximized() const override;
69 bool IsMinimized() const override;
70 bool IsFullscreen() const override;
71 gfx::NativeWindow GetNativeWindow() const override;
72 gfx::Rect GetRestoredBounds() const override;
73 ui::WindowShowState GetRestoredState() const override;
74 gfx::Rect GetBounds() const override;
75 void Show() override;
76 void ShowInactive() override;
77 void Hide() override;
78 void Close() override;
79 void Activate() override;
80 void Deactivate() override;
81 void Maximize() override;
82 void Minimize() override;
83 void Restore() override;
84 void SetBounds(const gfx::Rect& bounds) override;
85 void FlashFrame(bool flash) override;
86 bool IsAlwaysOnTop() const override;
87 void SetAlwaysOnTop(bool always_on_top) override;
88
89 private:
90 // Resets the icon and updates |controller_|'s active icon as needed.
91 void ResetIcon();
92
93 // ImageDecoder::ImageRequest:
94 void OnImageDecoded(const SkBitmap& decoded_image) override;
95
96 // Keeps associated ARC task id.
97 const int task_id_;
98 // Keeps ARC shelf grouping id.
99 const arc::ArcAppShelfId app_shelf_id_;
100 // Keeps shelf id.
101 ash::ShelfID shelf_id_;
102 // Keeps current full-screen mode.
103 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
104 // Contains custom icon if it was set.
105 gfx::ImageSkia icon_;
106 // Unowned pointers
107 views::Widget* const widget_;
108 ArcAppWindowLauncherController* const owner_;
109 ArcAppWindowLauncherItemController* controller_ = nullptr;
110
111 DISALLOW_COPY_AND_ASSIGN(ArcAppWindow);
112 };
113
114 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698