| OLD | NEW |
| (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 // TODO(khmel): use a bool set to false by default, or use an existing enum, |
| 29 // like ash::wm::WindowStateType. |
| 30 enum class FullScreenMode { |
| 31 NOT_DEFINED, // Fullscreen mode was not defined. |
| 32 ACTIVE, // Fullscreen is activated for an app. |
| 33 NON_ACTIVE, // Fullscreen was not activated for an app. |
| 34 }; |
| 35 |
| 36 ArcAppWindow(int task_id, |
| 37 const arc::ArcAppShelfId& app_shelf_id, |
| 38 views::Widget* widget, |
| 39 ArcAppWindowLauncherController* owner); |
| 40 |
| 41 ~ArcAppWindow() override; |
| 42 |
| 43 void SetController(ArcAppWindowLauncherItemController* controller); |
| 44 |
| 45 void SetFullscreenMode(FullScreenMode mode); |
| 46 |
| 47 // Sets optional window title and icon. Note that |unsafe_icon_data_png| has |
| 48 // to be decoded in separate process for security reason. |
| 49 void SetDescription(const std::string& title, |
| 50 const std::vector<uint8_t>& unsafe_icon_data_png); |
| 51 |
| 52 FullScreenMode fullscreen_mode() const { return fullscreen_mode_; } |
| 53 |
| 54 int task_id() const { return task_id_; } |
| 55 |
| 56 const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; } |
| 57 |
| 58 const ash::ShelfID& shelf_id() const { return shelf_id_; } |
| 59 |
| 60 void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; } |
| 61 |
| 62 views::Widget* widget() const { return widget_; } |
| 63 |
| 64 ArcAppWindowLauncherItemController* controller() { return controller_; } |
| 65 |
| 66 const gfx::ImageSkia& icon() const { return icon_; } |
| 67 |
| 68 // ui::BaseWindow: |
| 69 bool IsActive() const override; |
| 70 bool IsMaximized() const override; |
| 71 bool IsMinimized() const override; |
| 72 bool IsFullscreen() const override; |
| 73 gfx::NativeWindow GetNativeWindow() const override; |
| 74 gfx::Rect GetRestoredBounds() const override; |
| 75 ui::WindowShowState GetRestoredState() const override; |
| 76 gfx::Rect GetBounds() const override; |
| 77 void Show() override; |
| 78 void ShowInactive() override; |
| 79 void Hide() override; |
| 80 void Close() override; |
| 81 void Activate() override; |
| 82 void Deactivate() override; |
| 83 void Maximize() override; |
| 84 void Minimize() override; |
| 85 void Restore() override; |
| 86 void SetBounds(const gfx::Rect& bounds) override; |
| 87 void FlashFrame(bool flash) override; |
| 88 bool IsAlwaysOnTop() const override; |
| 89 void SetAlwaysOnTop(bool always_on_top) override; |
| 90 |
| 91 private: |
| 92 // Resets the icon and updates |controller_|'s active icon as needed. |
| 93 void ResetIcon(); |
| 94 |
| 95 // ImageDecoder::ImageRequest: |
| 96 void OnImageDecoded(const SkBitmap& decoded_image) override; |
| 97 |
| 98 // Keeps associated ARC task id. |
| 99 const int task_id_; |
| 100 // Keeps ARC shelf grouping id. |
| 101 const arc::ArcAppShelfId app_shelf_id_; |
| 102 // Keeps shelf id. |
| 103 ash::ShelfID shelf_id_; |
| 104 // Keeps current full-screen mode. |
| 105 FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED; |
| 106 // Contains custom icon if it was set. |
| 107 gfx::ImageSkia icon_; |
| 108 // Unowned pointers |
| 109 views::Widget* const widget_; |
| 110 ArcAppWindowLauncherController* const owner_; |
| 111 ArcAppWindowLauncherItemController* controller_ = nullptr; |
| 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(ArcAppWindow); |
| 114 }; |
| 115 |
| 116 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_ |
| OLD | NEW |