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

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

Issue 2883193002: WIP
Patch Set: git cl try 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 "ash/public/cpp/shelf_types.h"
9 #include "base/macros.h"
10 #include "chrome/browser/image_decoder.h"
11 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
12 #include "ui/aura/window_observer.h"
13 #include "ui/base/base_window.h"
14 #include "ui/gfx/image/image_skia.h"
15
16 class ArcAppWindowLauncherController;
17 class ArcAppWindowLauncherItemController;
18
19 namespace views {
20 class Widget;
21 }
22
23 // A ui::BaseWindow for a chromeos launcher to control ARC applications.
24 class ArcAppWindow : public ui::BaseWindow,
25 public aura::WindowObserver,
26 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 static void DisableSafeIconDecodingForTesting();
42
43 void SetController(ArcAppWindowLauncherItemController* controller);
44
45 void ResetController();
46
47 void SetFullscreenMode(FullScreenMode mode);
48
49 FullScreenMode fullscreen_mode() const { return fullscreen_mode_; }
50
51 int task_id() const { return task_id_; }
52
53 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; }
54
55 const ash::ShelfID& shelf_id() const { return shelf_id_; }
56
57 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; }
58
59 views::Widget* widget() const { return widget_; }
60
61 ArcAppWindowLauncherItemController* controller() { return controller_; }
62
63 const gfx::ImageSkia& image_skia() { return image_skia_; }
64
65 // ui::BaseWindow:
66 bool IsActive() const override;
67 bool IsMaximized() const override;
68 bool IsMinimized() const override;
69 bool IsFullscreen() const override;
70 gfx::NativeWindow GetNativeWindow() const override;
71 gfx::Rect GetRestoredBounds() const override;
72 ui::WindowShowState GetRestoredState() const override;
73 gfx::Rect GetBounds() const override;
74 void Show() override;
75 void ShowInactive() override;
76 void Hide() override;
77 void Close() override;
78 void Activate() override;
79 void Deactivate() override;
80 void Maximize() override;
81 void Minimize() override;
82 void Restore() override;
83 void SetBounds(const gfx::Rect& bounds) override;
84 void FlashFrame(bool flash) override;
85 bool IsAlwaysOnTop() const override;
86 void SetAlwaysOnTop(bool always_on_top) override;
87
88 private:
89 // Resets custom icon if it was previously set. If current window is an active
90 // window in context of controller then updates controller icon.
91 void ResetIcon();
92
93 // Extracts optional custom icon attached to the window in compressed png
94 // format. If data exists then IPC image decoder is started. If not then
95 // previously set custom icon is reset.
96 void ExtractIconFromWindow();
97
98 // aura::WindowObserver:
99 void OnWindowPropertyChanged(aura::Window* window,
100 const void* key,
101 intptr_t old) override;
102
103 // ImageDecoder::ImageRequest:
104 void OnImageDecoded(const SkBitmap& decoded_image) override;
105 void OnDecodeImageFailed() override;
106
107 const int task_id_;
108 const arc::ArcAppShelfId app_shelf_id_;
109 ash::ShelfID shelf_id_;
110 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
111 gfx::ImageSkia image_skia_;
112 // Unowned pointers
113 views::Widget* const widget_;
114 ArcAppWindowLauncherController* owner_;
115 ArcAppWindowLauncherItemController* controller_ = nullptr;
116
117 DISALLOW_COPY_AND_ASSIGN(ArcAppWindow);
118 };
119
120 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698