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

Unified Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.h

Issue 944123003: Hack webapp to request keyboard events on connection. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hacked up chromoting client and using mouse lock instead of keyboard lock for bubble. Created 5 years, 10 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/ui/views/apps/chrome_native_app_window_views.h
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views.h b/chrome/browser/ui/views/apps/chrome_native_app_window_views.h
index 06dd8286551aa8da737147eac9e4206c0fb193cd..eb8c8d44a7eacca200d9b35a5c507b638ac574cc 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views.h
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
+#include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
#include "extensions/components/native_app_window/native_app_window_views.h"
#include "ui/views/context_menu_controller.h"
@@ -20,6 +22,8 @@ class ImmersiveFullscreenController;
#endif
class DesktopKeyboardCapture;
+class ExclusiveAccessManager;
+class ExclusiveAccessBubbleViews;
class ExtensionKeybindingRegistryViews;
namespace views {
@@ -28,7 +32,9 @@ class MenuRunner;
class ChromeNativeAppWindowViews
: public native_app_window::NativeAppWindowViews,
- public views::ContextMenuController {
+ public views::ContextMenuController,
+ public ExclusiveAccessContext,
+ public ExclusiveAccessBubbleViewsContext {
public:
ChromeNativeAppWindowViews();
~ChromeNativeAppWindowViews() override;
@@ -47,6 +53,18 @@ class ChromeNativeAppWindowViews
const extensions::AppWindow::CreateParams& create_params);
virtual views::NonClientFrameView* CreateStandardDesktopAppFrame();
+ void Activate() override;
+ void Deactivate() override;
+ bool PreHandleKeyboardEvent(content::WebContents* source,
+ const content::NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut) override;
+
+ protected:
+ FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
+ ResizeInsetsWithinBounds);
+
+ apps::AppWindowFrameView* CreateNonStandardAppFrame();
+
// ui::BaseWindow implementation.
gfx::Rect GetRestoredBounds() const override;
ui::WindowShowState GetRestoredState() const override;
@@ -84,11 +102,32 @@ class ChromeNativeAppWindowViews
extensions::AppWindow* app_window,
const extensions::AppWindow::CreateParams& create_params) override;
- private:
- FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
- ResizeInsetsWithinBounds);
-
- apps::AppWindowFrameView* CreateNonStandardAppFrame();
+ // ExclusiveAccessContext
+ Profile* GetProfile() override;
+ bool IsFullscreen() const override;
+ bool IsFullscreenWithToolbar() override;
+ bool SupportsFullscreenWithToolbar() override;
+ void EnterFullscreen(const GURL& url,
+ ExclusiveAccessBubbleType bubble_type,
+ bool with_toolbar) override;
+ void ExitFullscreen() override;
+ void UpdateExclusiveAccessExitBubbleContent(
+ GURL url,
+ ExclusiveAccessBubbleType bubble_type) override;
+ content::WebContents* GetActiveWebContents() override;
+ void UpdateFullscreenWithToolbar(bool with_toolbar) override;
+ void SetMetroSnapMode(bool enable) override;
+ bool IsInMetroSnapMode() override;
+ void UpdateDownloadShelf(bool unhide) override;
+ // HACK:
+ bool UseCallbackForMouseLock() override;
+ bool MouseLockCallback(bool acquired) override;
+
+ // ExclusiveAccessBubbleViewsContext
+ ExclusiveAccessManager* GetExclusiveAccessManager() override;
+ views::Widget* GetWidget() override;
+ bool IsImmersiveModeEnabled() override;
+ gfx::Rect GetTopContainerBoundsInScreen() override;
// True if the window is fullscreen or fullscreen is pending.
bool is_fullscreen_;
@@ -119,6 +158,11 @@ class ChromeNativeAppWindowViews
// Used to capture all keyboard events including task switching sequence.
scoped_ptr<DesktopKeyboardCapture> desktop_keyboard_capture_;
+ bool key_capture_requested_;
+
+ // USed to show and control exclusive access bubble.
+ scoped_ptr<ExclusiveAccessManager> exclusive_access_manager_;
+ scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_views_;
DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews);
};

Powered by Google App Engine
This is Rietveld 408576698