blob: d4d0f69a7cc152ecb1945793086bc94b124e0720 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright (c) 2012 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_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
#pragma once
#import <Cocoa/Cocoa.h>
#import "base/mac/cocoa_protocols.h"
#include "base/memory/scoped_nsobject.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "ui/gfx/rect.h"
class ExtensionHost;
class ShellWindowCocoa;
// A window controller for a minimal window to host a web app view. Passes
// Objective-C notifications to the C++ bridge.
@interface ShellWindowController : NSWindowController<NSWindowDelegate> {
@private
ShellWindowCocoa* shellWindow_; // Weak; owns self.
}
@property(assign, nonatomic) ShellWindowCocoa* shellWindow;
@end
// Cocoa bridge to ShellWindow.
class ShellWindowCocoa : public ShellWindow {
public:
explicit ShellWindowCocoa(ExtensionHost* host);
// BaseWindow implementation.
virtual bool IsActive() const OVERRIDE;
virtual bool IsMaximized() const OVERRIDE;
virtual bool IsMinimized() const OVERRIDE;
virtual bool IsFullscreen() const OVERRIDE;
virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
virtual gfx::Rect GetBounds() const OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
virtual void Maximize() OVERRIDE;
virtual void Minimize() OVERRIDE;
virtual void Restore() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void SetDraggableRegion(SkRegion* region) OVERRIDE;
virtual void FlashFrame(bool flash) OVERRIDE;
virtual bool IsAlwaysOnTop() const OVERRIDE;
// Called when the window is about to be closed.
void WindowWillClose();
private:
virtual ~ShellWindowCocoa();
NSWindow* window() const;
scoped_nsobject<ShellWindowController> window_controller_;
NSInteger attention_request_id_; // identifier from requestUserAttention
DISALLOW_COPY_AND_ASSIGN(ShellWindowCocoa);
};
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_SHELL_WINDOW_COCOA_H_
|