| 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 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "chrome/browser/ui/browser_dialogs.h" | 10 #import "chrome/browser/ui/browser_dialogs.h" |
| 11 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 11 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 12 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 12 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 13 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 13 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 14 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
| 17 #include "content/public/browser/web_ui_message_handler.h" | 17 #include "content/public/browser/web_ui_message_handler.h" |
| 18 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 - (id)initWithDelegate:(WebDialogDelegate*)delegate | 310 - (id)initWithDelegate:(WebDialogDelegate*)delegate |
| 311 context:(content::BrowserContext*)context { | 311 context:(content::BrowserContext*)context { |
| 312 DCHECK(delegate); | 312 DCHECK(delegate); |
| 313 DCHECK(context); | 313 DCHECK(context); |
| 314 | 314 |
| 315 gfx::Size dialogSize; | 315 gfx::Size dialogSize; |
| 316 delegate->GetDialogSize(&dialogSize); | 316 delegate->GetDialogSize(&dialogSize); |
| 317 NSRect dialogRect = NSMakeRect(0, 0, dialogSize.width(), dialogSize.height()); | 317 NSRect dialogRect = NSMakeRect(0, 0, dialogSize.width(), dialogSize.height()); |
| 318 NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | | 318 NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | |
| 319 NSResizableWindowMask; | 319 NSResizableWindowMask; |
| 320 scoped_nsobject<ChromeEventProcessingWindow> window( | 320 base::scoped_nsobject<ChromeEventProcessingWindow> window( |
| 321 [[ChromeEventProcessingWindow alloc] | 321 [[ChromeEventProcessingWindow alloc] |
| 322 initWithContentRect:dialogRect | 322 initWithContentRect:dialogRect |
| 323 styleMask:style | 323 styleMask:style |
| 324 backing:NSBackingStoreBuffered | 324 backing:NSBackingStoreBuffered |
| 325 defer:YES]); | 325 defer:YES]); |
| 326 if (!window.get()) { | 326 if (!window.get()) { |
| 327 return nil; | 327 return nil; |
| 328 } | 328 } |
| 329 self = [super initWithWindow:window]; | 329 self = [super initWithWindow:window]; |
| 330 if (!self) { | 330 if (!self) { |
| 331 return nil; | 331 return nil; |
| 332 } | 332 } |
| 333 [window setWindowController:self]; | 333 [window setWindowController:self]; |
| 334 [window setDelegate:self]; | 334 [window setDelegate:self]; |
| 335 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; | 335 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 361 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 361 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 362 // to do the above doesn't work. | 362 // to do the above doesn't work. |
| 363 } | 363 } |
| 364 | 364 |
| 365 - (void)windowWillClose:(NSNotification*)notification { | 365 - (void)windowWillClose:(NSNotification*)notification { |
| 366 delegate_->WindowControllerClosed(); | 366 delegate_->WindowControllerClosed(); |
| 367 [self autorelease]; | 367 [self autorelease]; |
| 368 } | 368 } |
| 369 | 369 |
| 370 @end | 370 @end |
| OLD | NEW |