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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h

Issue 10825240: Refactor ShellWindow to separate platform-specific code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_nsobject.h" 11 #include "base/memory/scoped_nsobject.h"
12 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" 12 #include "chrome/browser/ui/cocoa/constrained_window_mac.h"
13 #include "chrome/browser/ui/extensions/native_shell_window.h"
13 #include "chrome/browser/ui/extensions/shell_window.h" 14 #include "chrome/browser/ui/extensions/shell_window.h"
14 #include "chrome/common/extensions/draggable_region.h" 15 #include "chrome/common/extensions/draggable_region.h"
16 #import "third_party/GTM/AppKit/GTMWindowSheetController.h"
15 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
16 #import "third_party/GTM/AppKit/GTMWindowSheetController.h"
17 18
18 class Profile; 19 class Profile;
19 class ShellWindowCocoa; 20 class ShellWindowCocoa;
20 21
21 // A window controller for a minimal window to host a web app view. Passes 22 // A window controller for a minimal window to host a web app view. Passes
22 // Objective-C notifications to the C++ bridge. 23 // Objective-C notifications to the C++ bridge.
23 @interface ShellWindowController : NSWindowController 24 @interface ShellWindowController : NSWindowController
24 <NSWindowDelegate, 25 <NSWindowDelegate,
25 GTMWindowSheetControllerDelegate, 26 GTMWindowSheetControllerDelegate,
26 ConstrainedWindowSupport> { 27 ConstrainedWindowSupport> {
27 @private 28 @private
28 ShellWindowCocoa* shellWindow_; // Weak; owns self. 29 ShellWindowCocoa* shellWindow_; // Weak; owns self.
29 // Manages per-window sheets. 30 // Manages per-window sheets.
30 scoped_nsobject<GTMWindowSheetController> sheetController_; 31 scoped_nsobject<GTMWindowSheetController> sheetController_;
31 } 32 }
32 33
33 @property(assign, nonatomic) ShellWindowCocoa* shellWindow; 34 @property(assign, nonatomic) ShellWindowCocoa* shellWindow;
34 35
35 @end 36 @end
36 37
37 // Cocoa bridge to ShellWindow. 38 // Cocoa bridge to ShellWindow.
38 class ShellWindowCocoa : public ShellWindow { 39 class ShellWindowCocoa : public NativeShellWindow {
39 public: 40 public:
40 ShellWindowCocoa(Profile* profile, 41 ShellWindowCocoa(ShellWindow* shell_window,
41 const extensions::Extension* extension, 42 const ShellWindow::CreateParams& params);
42 const GURL& url,
43 const CreateParams& params);
44 43
45 // BaseWindow implementation. 44 // BaseWindow implementation.
46 virtual bool IsActive() const OVERRIDE; 45 virtual bool IsActive() const OVERRIDE;
47 virtual bool IsMaximized() const OVERRIDE; 46 virtual bool IsMaximized() const OVERRIDE;
48 virtual bool IsMinimized() const OVERRIDE; 47 virtual bool IsMinimized() const OVERRIDE;
49 virtual bool IsFullscreen() const OVERRIDE; 48 virtual bool IsFullscreen() const OVERRIDE;
50 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 49 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
51 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 50 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
52 virtual gfx::Rect GetBounds() const OVERRIDE; 51 virtual gfx::Rect GetBounds() const OVERRIDE;
53 virtual void Show() OVERRIDE; 52 virtual void Show() OVERRIDE;
(...skipping 11 matching lines...) Expand all
65 // Called when the window is about to be closed. 64 // Called when the window is about to be closed.
66 void WindowWillClose(); 65 void WindowWillClose();
67 66
68 // Called when the window is focused. 67 // Called when the window is focused.
69 void WindowDidBecomeKey(); 68 void WindowDidBecomeKey();
70 69
71 // Called when the window is defocused. 70 // Called when the window is defocused.
72 void WindowDidResignKey(); 71 void WindowDidResignKey();
73 72
74 protected: 73 protected:
75 // ShellWindow implementation. 74 // NativeShellWindow implementation.
76 virtual void SetFullscreen(bool fullscreen) OVERRIDE; 75 virtual void SetFullscreen(bool fullscreen) OVERRIDE;
77 virtual bool IsFullscreenOrPending() const OVERRIDE; 76 virtual bool IsFullscreenOrPending() const OVERRIDE;
77 virtual void UpdateWindowTitle() OVERRIDE;
78 virtual void UpdateDraggableRegions(
79 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
78 80
79 private: 81 private:
80 virtual ~ShellWindowCocoa(); 82 virtual ~ShellWindowCocoa();
81 83
82 // ShellWindow implementation. 84 NSWindow* window() const;
83 virtual void UpdateDraggableRegions(
84 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
85 85
86 NSWindow* window() const; 86 content::WebContents* web_contents() const {
87 return shell_window_->web_contents();
88 }
89 const extensions::Extension* extension() const {
90 return shell_window_->extension();
91 }
87 92
88 void InstallView(); 93 void InstallView();
89 void UninstallView(); 94 void UninstallView();
90 void InstallDraggableRegionViews(); 95 void InstallDraggableRegionViews();
91 96
97 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
98
92 bool has_frame_; 99 bool has_frame_;
93 100
94 bool is_fullscreen_; 101 bool is_fullscreen_;
95 NSRect restored_bounds_; 102 NSRect restored_bounds_;
96 103
97 scoped_nsobject<ShellWindowController> window_controller_; 104 scoped_nsobject<ShellWindowController> window_controller_;
98 NSInteger attention_request_id_; // identifier from requestUserAttention 105 NSInteger attention_request_id_; // identifier from requestUserAttention
99 106
100 std::vector<extensions::DraggableRegion> draggable_regions_; 107 std::vector<extensions::DraggableRegion> draggable_regions_;
101 108
102 DISALLOW_COPY_AND_ASSIGN(ShellWindowCocoa); 109 DISALLOW_COPY_AND_ASSIGN(ShellWindowCocoa);
103 }; 110 };
104 111
105 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_ 112 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698