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->model(); |
462 intentButtons_.reset([[NSMutableArray alloc] init]); | 464 intentButtons_.reset([[NSMutableArray alloc] init]); |
463 [self performLayoutWithModel:NULL]; | 465 [self performLayoutWithModel:model_]; |
464 [[self window] makeFirstResponder:self]; | 466 [[self window] makeFirstResponder:self]; |
465 } | 467 } |
466 return self; | 468 return self; |
467 } | 469 } |
468 | 470 |
469 // Handle default OSX dialog cancel mechanisms. (Cmd-.) | 471 // Handle default OSX dialog cancel mechanisms. (Cmd-.) |
470 - (void)cancelOperation:(id)sender { | 472 - (void)cancelOperation:(id)sender { |
471 if (picker_) | 473 if (picker_) |
472 picker_->OnCancelled(); | 474 picker_->OnCancelled(); |
473 [self closeSheet]; | 475 [self closeSheet]; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 - (void)stopThrobber { | 743 - (void)stopThrobber { |
742 [closeButton_ setEnabled:YES]; | 744 [closeButton_ setEnabled:YES]; |
743 [self setIntentButtonsEnabled:YES]; | 745 [self setIntentButtonsEnabled:YES]; |
744 [suggestionView_ stopThrobber]; | 746 [suggestionView_ stopThrobber]; |
745 } | 747 } |
746 | 748 |
747 - (void)closeSheet { | 749 - (void)closeSheet { |
748 [NSApp endSheet:[self window]]; | 750 [NSApp endSheet:[self window]]; |
749 } | 751 } |
750 @end // WebIntentPickerSheetController | 752 @end // WebIntentPickerSheetController |
OLD | NEW |