Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ |
| 6 #define CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | |
| 8 #include "chrome/browser/ui/extensions/shell_window.h" | 9 #include "chrome/browser/ui/extensions/shell_window.h" |
| 9 #include "chrome/browser/ui/base_window.h" | 10 #include "chrome/browser/ui/base_window.h" |
| 11 #include "third_party/skia/include/core/SkRegion.h" | |
| 10 | 12 |
| 11 // This is an interface to a native implementation of a shell window, used for | 13 // This is an interface to a native implementation of a shell window, used for |
| 12 // new-style packaged apps. Shell windows contain a web contents, but no tabs | 14 // new-style packaged apps. Shell windows contain a web contents, but no tabs |
| 13 // or URL bar. | 15 // or URL bar. |
| 14 class NativeShellWindow : public BaseWindow { | 16 class NativeShellWindow : public BaseWindow { |
| 15 public: | 17 public: |
| 16 // Used by ShellWindow to instantiate the platform-specific ShellWindow code. | 18 // Used by ShellWindow to instantiate the platform-specific ShellWindow code. |
| 17 static NativeShellWindow* Create(ShellWindow* window, | 19 static NativeShellWindow* Create(ShellWindow* shell_window, |
| 18 const ShellWindow::CreateParams& params); | 20 const ShellWindow::CreateParams& params); |
| 19 | 21 |
| 20 // Called when the draggable regions are changed. | 22 // Called when the draggable regions are changed. |
| 21 virtual void UpdateDraggableRegions( | 23 virtual void UpdateDraggableRegions( |
| 22 const std::vector<extensions::DraggableRegion>& regions) {} | 24 const std::vector<extensions::DraggableRegion>& regions); |
| 23 | |
| 24 // Called when the draggable regions with the old syntax are changed. | |
| 25 // TODO(jianli): to be removed after WebKit patch that changes the draggable | |
| 26 // region syntax is landed. | |
| 27 virtual void UpdateLegacyDraggableRegions( | |
| 28 const std::vector<extensions::DraggableRegion>& regions) {} | |
| 29 | 25 |
| 30 virtual void SetFullscreen(bool fullscreen) = 0; | 26 virtual void SetFullscreen(bool fullscreen) = 0; |
| 31 virtual bool IsFullscreenOrPending() const = 0; | 27 virtual bool IsFullscreenOrPending() const = 0; |
| 32 | 28 |
| 33 // Called when the icon of the window changes. | 29 // Called when the icon of the window changes. |
| 34 virtual void UpdateWindowIcon() = 0; | 30 virtual void UpdateWindowIcon() = 0; |
| 35 | 31 |
| 36 // Called when the title of the window changes. | 32 // Called when the title of the window changes. |
| 37 virtual void UpdateWindowTitle() = 0; | 33 virtual void UpdateWindowTitle() = 0; |
| 38 | 34 |
| 39 // Allows the window to handle unhandled keyboard messages coming back from | 35 // Allows the window to handle unhandled keyboard messages coming back from |
| 40 // the renderer. | 36 // the renderer. |
| 41 virtual void HandleKeyboardEvent( | 37 virtual void HandleKeyboardEvent( |
| 42 const content::NativeWebKeyboardEvent& event) = 0; | 38 const content::NativeWebKeyboardEvent& event) = 0; |
| 43 | 39 |
| 44 virtual ~NativeShellWindow() {} | 40 virtual ~NativeShellWindow(); |
| 41 | |
| 42 // Returns true if point (|x|, |y|) falls within the draggable regions. | |
| 43 bool IsInsideDraggableRegions(int x, int y) const; | |
| 44 | |
| 45 bool frameless() const { return frameless_; } | |
| 46 SkRegion* draggable_regions() const { return draggable_regions_.get(); } | |
| 47 | |
| 48 protected: | |
| 49 explicit NativeShellWindow(const ShellWindow::CreateParams& params); | |
| 50 | |
| 51 private: | |
| 52 bool frameless_; | |
|
Ben Goodger (Google)
2012/10/12 16:24:41
since this is an interface, you can't have state l
jianli
2012/10/12 21:39:40
Changed to put the common draggable region convers
| |
| 53 scoped_ptr<SkRegion> draggable_regions_; | |
| 45 }; | 54 }; |
| 46 | 55 |
| 47 #endif // CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ | 56 #endif // CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_ |
| OLD | NEW |