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

Unified Diff: chrome/browser/extensions/api/tabs/app_window_controller.h

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add application windows resize constraint test Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/app_window_controller.h
diff --git a/chrome/browser/extensions/api/tabs/app_window_controller.h b/chrome/browser/extensions/api/tabs/app_window_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fe29001cbd906f8328a92bf33f5107540861c2a
--- /dev/null
+++ b/chrome/browser/extensions/api/tabs/app_window_controller.h
@@ -0,0 +1,91 @@
+// Copyright 2015 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_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_
+#define CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "chrome/browser/extensions/window_controller.h"
+#include "ui/base/base_window.h"
+
+class Profile;
+
+namespace extensions {
+
+class AppWindow;
+class AppBaseWindow;
+class NativeAppWindow;
+
+// A custom ui::BaseWindow to be given to a WindowController. It
+// allows us to constrain some operations on application windows (like
+// SetBounds).
+class AppBaseWindow : public ui::BaseWindow {
+ public:
+ explicit AppBaseWindow(AppWindow* app_window);
+ virtual ~AppBaseWindow();
+
+ private:
+ 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 Hide() override;
+ void ShowInactive() 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;
+
+ NativeAppWindow* GetBaseWindow() const;
+
+ AppWindow* app_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppBaseWindow);
+};
+
+// A extensions::WindowController specific to extensions::AppWindow.
+class AppWindowController : public WindowController {
+ public:
+ AppWindowController(AppWindow* window,
+ scoped_ptr<AppBaseWindow> base_window,
+ Profile* profile);
+ ~AppWindowController() override;
+
+ // extensions::WindowController:
+ int GetWindowId() const override;
+ std::string GetWindowTypeText() const override;
+ base::DictionaryValue* CreateWindowValueWithTabs(
+ const Extension* extension) const override;
+ base::DictionaryValue* CreateTabValue(const Extension* extension,
+ int tab_index) const override;
+ bool CanClose(Reason* reason) const override;
+ void SetFullscreenMode(bool is_fullscreen,
+ const GURL& extension_url) const override;
+ Browser* GetBrowser() const override;
+ bool IsVisibleToExtension(const Extension* extension) const override;
+
+ private:
+ AppWindow* app_window_; // Owns us.
+ scoped_ptr<AppBaseWindow> base_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppWindowController);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698