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_intent_sheet_controller.h" | 5 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 // |window| is retained by the ConstrainedWindowMacDelegateCustomSheet when | 452 // |window| is retained by the ConstrainedWindowMacDelegateCustomSheet when |
453 // the sheet is initialized. | 453 // the sheet is initialized. |
454 scoped_nsobject<NSWindow> window( | 454 scoped_nsobject<NSWindow> window( |
455 [[NSWindow alloc] initWithContentRect:contentRect | 455 [[NSWindow alloc] initWithContentRect:contentRect |
456 styleMask:NSTitledWindowMask | 456 styleMask:NSTitledWindowMask |
457 backing:NSBackingStoreBuffered | 457 backing:NSBackingStoreBuffered |
458 defer:YES]); | 458 defer:YES]); |
459 | 459 |
460 if ((self = [super initWithWindow:window.get()])) { | 460 if ((self = [super initWithWindow:window.get()])) { |
461 picker_ = picker; | 461 picker_ = picker; |
462 if (picker) | |
463 model_ = picker->get_model(); | |
464 else | |
465 model_ = NULL; | |
Robert Sesek
2012/05/22 00:19:54
Cocoa will initialize this for you to 0, so you do
groby-ooo-7-16
2012/05/22 00:32:09
Done.
| |
462 intentButtons_.reset([[NSMutableArray alloc] init]); | 466 intentButtons_.reset([[NSMutableArray alloc] init]); |
463 [self performLayoutWithModel:NULL]; | 467 [self performLayoutWithModel:model_]; |
464 [[self window] makeFirstResponder:self]; | 468 [[self window] makeFirstResponder:self]; |
465 } | 469 } |
466 return self; | 470 return self; |
467 } | 471 } |
468 | 472 |
469 // Handle default OSX dialog cancel mechanisms. (Cmd-.) | 473 // Handle default OSX dialog cancel mechanisms. (Cmd-.) |
470 - (void)cancelOperation:(id)sender { | 474 - (void)cancelOperation:(id)sender { |
471 if (picker_) | 475 if (picker_) |
472 picker_->OnCancelled(); | 476 picker_->OnCancelled(); |
473 [self closeSheet]; | 477 [self closeSheet]; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 - (void)stopThrobber { | 745 - (void)stopThrobber { |
742 [closeButton_ setEnabled:YES]; | 746 [closeButton_ setEnabled:YES]; |
743 [self setIntentButtonsEnabled:YES]; | 747 [self setIntentButtonsEnabled:YES]; |
744 [suggestionView_ stopThrobber]; | 748 [suggestionView_ stopThrobber]; |
745 } | 749 } |
746 | 750 |
747 - (void)closeSheet { | 751 - (void)closeSheet { |
748 [NSApp endSheet:[self window]]; | 752 [NSApp endSheet:[self window]]; |
749 } | 753 } |
750 @end // WebIntentPickerSheetController | 754 @end // WebIntentPickerSheetController |
OLD | NEW |