#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
#include "extensions/common/extension.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skia_util.h"
shows_resize_controls_(true),
shows_fullscreen_controls_(true),
attention_request_id_(0) {
- Observe(web_contents());
+ Observe(WebContents());
base::scoped_nsobject<NSWindow> window;
Class window_class;
styleMask:GetWindowStyleMask()
backing:NSBackingStoreBuffered
defer:NO]);
- [window setTitle:base::SysUTF8ToNSString(extension()->name())];
+
+ std::string name;
+ const extensions::Extension* extension = app_window_->GetExtension();
+ if (extension)
+ name = extension->name();
+ [window setTitle:base::SysUTF8ToNSString(name)];
[[window contentView] cr_setWantsLayer:YES];
if (base::mac::IsOSSnowLeopard() &&
window_controller_.reset(
[[NativeAppWindowController alloc] initWithWindow:window.release()]);
- NSView* view = web_contents()->GetView()->GetNativeView();
+ NSView* view = WebContents()->GetNativeView();
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
InstallView();
}
void NativeAppWindowCocoa::InstallView() {
- NSView* view = web_contents()->GetView()->GetNativeView();
+ NSView* view = WebContents()->GetNativeView();
if (has_frame_) {
[view setFrame:[[window() contentView] bounds]];
[[window() contentView] addSubview:view];
}
void NativeAppWindowCocoa::UninstallView() {
- NSView* view = web_contents()->GetView()->GetNativeView();
+ NSView* view = WebContents()->GetNativeView();
[view removeFromSuperview];
}
// All ControlRegionViews should be added as children of the WebContentsView,
// because WebContentsView will be removed and re-added when entering and
// leaving fullscreen mode.
- NSView* webView = web_contents()->GetView()->GetNativeView();
+ NSView* webView = WebContents()->GetNativeView();
NSInteger webViewWidth = NSWidth([webView bounds]);
NSInteger webViewHeight = NSHeight([webView bounds]);
void NativeAppWindowCocoa::RenderViewCreated(content::RenderViewHost* rvh) {
if (IsActive())
- web_contents()->GetView()->RestoreFocus();
+ WebContents()->RestoreFocus();
}
bool NativeAppWindowCocoa::IsFrameless() const {
return false;
}
-SkColor NativeAppWindowCocoa::FrameColor() const {
+SkColor NativeAppWindowCocoa::ActiveFrameColor() const {
+ // TODO(benwells): Implement this.
+ return SkColor();
+}
+
+SkColor NativeAppWindowCocoa::InactiveFrameColor() const {
// TODO(benwells): Implement this.
return SkColor();
}
void NativeAppWindowCocoa::WindowDidBecomeKey() {
content::RenderWidgetHostView* rwhv =
- web_contents()->GetRenderWidgetHostView();
+ WebContents()->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetActive(true);
app_window_->OnNativeWindowActivated();
- web_contents()->GetView()->RestoreFocus();
+ WebContents()->RestoreFocus();
}
void NativeAppWindowCocoa::WindowDidResignKey() {
if ([NSApp isActive] && ([NSApp keyWindow] == window()))
return;
- web_contents()->GetView()->StoreFocus();
+ WebContents()->StoreFocus();
content::RenderWidgetHostView* rwhv =
- web_contents()->GetRenderWidgetHostView();
+ WebContents()->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetActive(false);
}
return static_cast<ShellNSWindow*>(window);
}
+content::WebContents* NativeAppWindowCocoa::WebContents() const {
+ return app_window_->web_contents();
+}
+
void NativeAppWindowCocoa::UpdateRestoredBounds() {
if (IsRestored(*this))
restored_bounds_ = [window() frame];