| 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..3d92686447b56af28e5f8ea89b5f032f533ee3cf
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/ash/launcher/arc_app_window.h
|
| @@ -0,0 +1,120 @@
|
| +// 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 "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/aura/window_observer.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 aura::WindowObserver,
|
| + public ImageDecoder::ImageRequest {
|
| + public:
|
| + 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;
|
| +
|
| + static void DisableSafeIconDecodingForTesting();
|
| +
|
| + void SetController(ArcAppWindowLauncherItemController* controller);
|
| +
|
| + void ResetController();
|
| +
|
| + void SetFullscreenMode(FullScreenMode mode);
|
| +
|
| + 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& image_skia() { return image_skia_; }
|
| +
|
| + // 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 custom icon if it was previously set. If current window is an active
|
| + // window in context of controller then updates controller icon.
|
| + void ResetIcon();
|
| +
|
| + // Extracts optional custom icon attached to the window in compressed png
|
| + // format. If data exists then IPC image decoder is started. If not then
|
| + // previously set custom icon is reset.
|
| + void ExtractIconFromWindow();
|
| +
|
| + // aura::WindowObserver:
|
| + void OnWindowPropertyChanged(aura::Window* window,
|
| + const void* key,
|
| + intptr_t old) override;
|
| +
|
| + // ImageDecoder::ImageRequest:
|
| + void OnImageDecoded(const SkBitmap& decoded_image) override;
|
| + void OnDecodeImageFailed() override;
|
| +
|
| + const int task_id_;
|
| + const arc::ArcAppShelfId app_shelf_id_;
|
| + ash::ShelfID shelf_id_;
|
| + FullScreenMode fullscreen_mode_ = FullScreenMode::NOT_DEFINED;
|
| + gfx::ImageSkia image_skia_;
|
| + // Unowned pointers
|
| + views::Widget* const widget_;
|
| + ArcAppWindowLauncherController* owner_;
|
| + ArcAppWindowLauncherItemController* controller_ = nullptr;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcAppWindow);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_H_
|
|
|