gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / ui / app_list / cocoa / app_list_window_controller.mm
blob47edab050747daf1be4e5a738d5aeddbd5f6c311
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "ui/app_list/cocoa/app_list_window_controller.h"
7 #include "ui/app_list/app_list_view_delegate.h"
8 #import "ui/app_list/cocoa/app_list_view_controller.h"
9 #import "ui/app_list/cocoa/apps_grid_controller.h"
10 #include "ui/base/cocoa/window_size_constants.h"
12 @interface AppListWindow : NSWindow;
13 @end
15 @implementation AppListWindow
17 // If we initialize a window with NSBorderlessWindowMask, it will not accept key
18 // events (among other things) unless canBecomeKeyWindow is overridden.
19 - (BOOL)canBecomeKeyWindow {
20   return YES;
23 - (BOOL)canBecomeMainWindow {
24   return YES;
27 @end
29 @implementation AppListWindowController;
31 - (id)init {
32   base::scoped_nsobject<NSWindow> controlledWindow(
33       [[AppListWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater
34                                        styleMask:NSBorderlessWindowMask
35                                          backing:NSBackingStoreBuffered
36                                            defer:NO]);
37   [controlledWindow setReleasedWhenClosed:NO];
38   [controlledWindow setBackgroundColor:[NSColor clearColor]];
39   [controlledWindow setOpaque:NO];
40   [controlledWindow setHasShadow:YES];
41   [controlledWindow setLevel:NSDockWindowLevel];
43   if ((self = [super initWithWindow:controlledWindow])) {
44     appListViewController_.reset([[AppListViewController alloc] init]);
45     [[self window] setFrame:[[appListViewController_ view] bounds]
46                     display:NO];
47     [[self window] setContentView:[appListViewController_ view]];
48     [[self window] setDelegate:self];
49   }
50   return self;
53 - (AppListViewController*)appListViewController {
54   return appListViewController_;
57 - (void)windowDidResignMain:(NSNotification*)notification {
58   if ([appListViewController_ delegate])
59     [appListViewController_ delegate]->Dismiss();
62 @end