| Index: chrome/browser/ui/ash/launcher/arc_app_window.h
|
| diff --git a/chrome/browser/ui/ash/launcher/arc_app_window.h b/chrome/browser/ui/ash/launcher/arc_app_window.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ffef2ba06042266456663ed3bb8d31909d5d26b7
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/ash/launcher/arc_app_window.h
|
| @@ -0,0 +1,116 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
|
| +#define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "ash/public/cpp/shelf_types.h"
|
| +#include "base/macros.h"
|
| +#include "chrome/browser/image_decoder.h"
|
| +#include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
|
| +#include "ui/base/base_window.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| +
|
| +class ArcAppWindowLauncherController;
|
| +class ArcAppWindowLauncherItemController;
|
| +
|
| +namespace views {
|
| +class Widget;
|
| +}
|
| +
|
| +// A ui::BaseWindow for a chromeos launcher to control ARC applications.
|
| +class ArcAppWindow : public ui::BaseWindow, public ImageDecoder::ImageRequest {
|
| + public:
|
| + // TODO(khmel): use a bool set to false by default, or use an existing enum,
|
| + // like ash::wm::WindowStateType.
|
| + enum class FullScreenMode {
|
| + NOT_DEFINED, // Fullscreen mode was not defined.
|
| + ACTIVE, // Fullscreen is activated for an app.
|
| + NON_ACTIVE, // Fullscreen was not activated for an app.
|
| + };
|
| +
|
| + ArcAppWindow(int task_id,
|
| + const arc::ArcAppShelfId& app_shelf_id,
|
| + views::Widget* widget,
|
| + ArcAppWindowLauncherController* owner);
|
| +
|
| + ~ArcAppWindow() override;
|
| +
|
| + void SetController(ArcAppWindowLauncherItemController* controller);
|
| +
|
| + void SetFullscreenMode(FullScreenMode mode);
|
| +
|
| + // Sets optional window title and icon. Note that |unsafe_icon_data_png| has
|
| + // to be decoded in separate process for security reason.
|
| + void SetDescription(const std::string& title,
|
| + const std::vector<uint8_t>& unsafe_icon_data_png);
|
| +
|
| + FullScreenMode fullscreen_mode() const { return fullscreen_mode_; }
|
| +
|
| + int task_id() const { return task_id_; }
|
| +
|
| + const arc::ArcAppShelfId& app_shelf_id() const { return app_shelf_id_; }
|
| +
|
| + const ash::ShelfID& shelf_id() const { return shelf_id_; }
|
| +
|
| + void set_shelf_id(const ash::ShelfID& shelf_id) { shelf_id_ = shelf_id; }
|
| +
|
| + views::Widget* widget() const { return widget_; }
|
| +
|
| + ArcAppWindowLauncherItemController* controller() { return controller_; }
|
| +
|
| + const gfx::ImageSkia& icon() const { return icon_; }
|
| +
|
| + // ui::BaseWindow:
|
| + bool IsActive() const override;
|
| + bool IsMaximized() const override;
|
| + bool IsMinimized() const override;
|
| + bool IsFullscreen() const override;
|
| + gfx::NativeWindow GetNativeWindow() const override;
|
| + gfx::Rect GetRestoredBounds() const override;
|
| + ui::WindowShowState GetRestoredState() const override;
|
| + gfx::Rect GetBounds() const override;
|
| + void Show() override;
|
| + void ShowInactive() override;
|
| + void Hide() override;
|
| + void Close() override;
|
| + void Activate() override;
|
| + void Deactivate() override;
|
| + void Maximize() override;
|
| + void Minimize() override;
|
| + void Restore() override;
|
| + void SetBounds(const gfx::Rect& bounds) override;
|
| + void FlashFrame(bool flash) override;
|
| + bool IsAlwaysOnTop() const override;
|
| + void SetAlwaysOnTop(bool always_on_top) override;
|
| +
|
| + private:
|
| + // Resets the icon and updates |controller_|'s active icon as needed.
|
| + void ResetIcon();
|
| +
|
| + // ImageDecoder::ImageRequest:
|
| + void OnImageDecoded(const SkBitmap& decoded_image) override;
|
| +
|
| + // Keeps associated ARC task id.
|
| + const int task_id_;
|
| + // Keeps ARC shelf grouping id.
|
| + const arc::ArcAppShelfId app_shelf_id_;
|
| + // Keeps shelf id.
|
| + ash::ShelfID shelf_id_;
|
| + // Keeps current full-screen mode.
|
| + FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
|
| + // Contains custom icon if it was set.
|
| + gfx::ImageSkia icon_;
|
| + // Unowned pointers
|
| + views::Widget* const widget_;
|
| + ArcAppWindowLauncherController* const owner_;
|
| + ArcAppWindowLauncherItemController* controller_ = nullptr;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcAppWindow);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
|
|
|