OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/translate/translate_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #import "chrome/browser/ui/cocoa/bubble_combobox.h" | 14 #import "chrome/browser/ui/cocoa/bubble_combobox.h" |
13 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
14 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
15 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
16 #include "chrome/browser/ui/translate/language_combobox_model.h" | 18 #include "chrome/browser/ui/translate/language_combobox_model.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 base::scoped_nsobject<InfoBubbleWindow> window( | 119 base::scoped_nsobject<InfoBubbleWindow> window( |
118 [[InfoBubbleWindow alloc] initWithContentRect:contentRect | 120 [[InfoBubbleWindow alloc] initWithContentRect:contentRect |
119 styleMask:NSBorderlessWindowMask | 121 styleMask:NSBorderlessWindowMask |
120 backing:NSBackingStoreBuffered | 122 backing:NSBackingStoreBuffered |
121 defer:NO]); | 123 defer:NO]); |
122 | 124 |
123 if ((self = [super initWithWindow:window | 125 if ((self = [super initWithWindow:window |
124 parentWindow:parentWindow | 126 parentWindow:parentWindow |
125 anchoredAt:NSZeroPoint])) { | 127 anchoredAt:NSZeroPoint])) { |
126 webContents_ = webContents; | 128 webContents_ = webContents; |
127 model_ = model.Pass(); | 129 model_ = std::move(model); |
128 if (model_->GetViewState() != | 130 if (model_->GetViewState() != |
129 TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE) { | 131 TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE) { |
130 translateExecuted_ = YES; | 132 translateExecuted_ = YES; |
131 } | 133 } |
132 | 134 |
133 views_.reset([@{ | 135 views_.reset([@{ |
134 @(TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE): | 136 @(TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE): |
135 [self newBeforeTranslateView], | 137 [self newBeforeTranslateView], |
136 @(TranslateBubbleModel::VIEW_STATE_TRANSLATING): | 138 @(TranslateBubbleModel::VIEW_STATE_TRANSLATING): |
137 [self newTranslatingView], | 139 [self newTranslatingView], |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 [self updateAdvancedView]; | 642 [self updateAdvancedView]; |
641 } | 643 } |
642 | 644 |
643 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender { | 645 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender { |
644 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender); | 646 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender); |
645 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]); | 647 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]); |
646 [self updateAdvancedView]; | 648 [self updateAdvancedView]; |
647 } | 649 } |
648 | 650 |
649 @end | 651 @end |
OLD | NEW |