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

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: cleanup 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 {
xiyuan 2017/05/18 16:22:49 Is this done by "git cl format"? If not, might be
khmel 2017/05/18 17:29:34 Hmm, I always put this to separate line. So this i
xiyuan 2017/05/18 17:33:30 Acknowledged.
msw 2017/05/18 18:26:51 It's too bad that we can't use and extend an exist
khmel 2017/05/18 22:40:02 Probably, but that is outside of context of this C
27 public:
28 enum class FullScreenMode {
msw 2017/05/18 18:26:50 Remove this and use a bool set to false by default
khmel 2017/05/18 20:27:51 This is legacy code and I don't touch this functio
msw 2017/05/18 22:03:39 Add a TODO, this is technical debt.
khmel 2017/05/18 22:40:02 Done.
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 static void DisableSafeIconDecodingForTesting();
msw 2017/05/18 18:26:56 Add comments for all non-obvious (non-accessor/set
khmel 2017/05/18 20:27:51 Done.
42
43 void SetController(ArcAppWindowLauncherItemController* controller);
44
45 void ResetController();
msw 2017/05/18 18:26:53 Remove this, let users call SetController(nullptr)
khmel 2017/05/18 20:27:51 Done.
46
47 void SetFullscreenMode(FullScreenMode mode);
48
49 // Sets optional window title and icon.
50 void SetDescription(const std::string& title,
msw 2017/05/18 18:26:49 Should this be two separate functions?
khmel 2017/05/18 20:27:51 They are set together. Imho we can handle it toget
51 const std::vector<uint8_t>& unsafe_icon_data_png);
msw 2017/05/18 18:26:58 nit: "unsafe" needs a comment.
khmel 2017/05/18 20:27:51 Done
52
53 FullScreenMode fullscreen_mode() const { return fullscreen_mode_; }
54
55 int task_id() const { return task_id_; }
56
57 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; }
58
59 const ash::ShelfID& shelf_id() const { return shelf_id_; }
60
61 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; }
62
63 views::Widget* widget() const { return widget_; }
64
65 ArcAppWindowLauncherItemController* controller() { return controller_; }
msw 2017/05/18 18:26:50 nit: const?
khmel 2017/05/18 20:27:51 Done. However in one of my previous CL reviewer to
msw 2017/05/18 22:03:39 Ah, good point; feel free to keep this non-const.
khmel 2017/05/18 22:40:02 Done.
66
67 const gfx::ImageSkia& image_skia() { return image_skia_; }
msw 2017/05/18 18:26:59 nit: const?
khmel 2017/05/18 20:27:51 Done.
68
69 // ui::BaseWindow:
70 bool IsActive() const override;
71 bool IsMaximized() const override;
72 bool IsMinimized() const override;
73 bool IsFullscreen() const override;
74 gfx::NativeWindow GetNativeWindow() const override;
75 gfx::Rect GetRestoredBounds() const override;
76 ui::WindowShowState GetRestoredState() const override;
77 gfx::Rect GetBounds() const override;
78 void Show() override;
79 void ShowInactive() override;
80 void Hide() override;
81 void Close() override;
82 void Activate() override;
83 void Deactivate() override;
84 void Maximize() override;
85 void Minimize() override;
86 void Restore() override;
87 void SetBounds(const gfx::Rect& bounds) override;
88 void FlashFrame(bool flash) override;
89 bool IsAlwaysOnTop() const override;
90 void SetAlwaysOnTop(bool always_on_top) override;
91
92 private:
93 // Resets custom icon if it was previously set. If current window is an active
msw 2017/05/18 18:26:57 nit: maybe just " // Resets the icon and updates
khmel 2017/05/18 20:27:51 I described in other comments that user may want t
94 // window in context of controller then updates controller icon.
95 void ResetIcon();
96
97 // ImageDecoder::ImageRequest:
98 void OnImageDecoded(const SkBitmap& decoded_image) override;
99 void OnDecodeImageFailed() override;
100
101 const int task_id_;
msw 2017/05/18 18:26:52 Please comment on all members.
khmel 2017/05/18 20:27:51 Done.
102 const arc::ArcAppShelfId app_shelf_id_;
103 ash::ShelfID shelf_id_;
104 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
105 gfx::ImageSkia image_skia_;
msw 2017/05/18 18:26:55 nit: Rename this and the accessor to convey the pu
khmel 2017/05/18 22:40:02 Done.
106 // Unowned pointers
107 views::Widget* const widget_;
108 ArcAppWindowLauncherController* owner_;
xiyuan 2017/05/18 16:22:49 nit: ArcAppWindowLauncherController* const owner_;
khmel 2017/05/18 17:29:34 Done.
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