Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 7 #include <utility>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #import "chrome/browser/ui/cocoa/bubble_combobox.h" 14 #import "chrome/browser/ui/cocoa/bubble_combobox.h"
15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
18 #include "chrome/browser/ui/translate/language_combobox_model.h" 18 #include "chrome/browser/ui/translate/language_combobox_model.h"
19 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" 19 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "components/translate/core/browser/translate_ui_delegate.h" 21 #include "components/translate/core/browser/translate_ui_delegate.h"
22 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
23 #include "grit/components_strings.h" 23 #include "grit/components_strings.h"
24 #include "ui/base/cocoa/cocoa_base_utils.h"
24 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 25 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
25 #import "ui/base/cocoa/window_size_constants.h" 26 #import "ui/base/cocoa/window_size_constants.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/models/combobox_model.h" 28 #include "ui/base/models/combobox_model.h"
28 29
29 // TODO(hajimehoshi): This class is almost same as that of views. Refactor them. 30 // TODO(hajimehoshi): This class is almost same as that of views. Refactor them.
30 class TranslateDenialComboboxModel : public ui::ComboboxModel { 31 class TranslateDenialComboboxModel : public ui::ComboboxModel {
31 public: 32 public:
32 explicit TranslateDenialComboboxModel( 33 explicit TranslateDenialComboboxModel(
33 const base::string16& original_language_name) { 34 const base::string16& original_language_name) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return view; 160 return view;
160 } 161 }
161 162
162 - (const TranslateBubbleModel*)model { 163 - (const TranslateBubbleModel*)model {
163 return model_.get(); 164 return model_.get();
164 } 165 }
165 166
166 - (void)showWindow:(id)sender { 167 - (void)showWindow:(id)sender {
167 BrowserWindowController* controller = [[self parentWindow] windowController]; 168 BrowserWindowController* controller = [[self parentWindow] windowController];
168 NSPoint anchorPoint = [[controller toolbarController] translateBubblePoint]; 169 NSPoint anchorPoint = [[controller toolbarController] translateBubblePoint];
169 anchorPoint = [[self parentWindow] convertBaseToScreen:anchorPoint]; 170 anchorPoint =
171 ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint);
170 [self setAnchorPoint:anchorPoint]; 172 [self setAnchorPoint:anchorPoint];
171 [super showWindow:sender]; 173 [super showWindow:sender];
172 } 174 }
173 175
174 - (void)switchView:(TranslateBubbleModel::ViewState)viewState { 176 - (void)switchView:(TranslateBubbleModel::ViewState)viewState {
175 if (model_->GetViewState() == viewState) 177 if (model_->GetViewState() == viewState)
176 return; 178 return;
177 179
178 model_->SetViewState(viewState); 180 model_->SetViewState(viewState);
179 [self performLayout]; 181 [self performLayout];
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 [self updateAdvancedView]; 644 [self updateAdvancedView];
643 } 645 }
644 646
645 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender { 647 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender {
646 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender); 648 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender);
647 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]); 649 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]);
648 [self updateAdvancedView]; 650 [self updateAdvancedView];
649 } 651 }
650 652
651 @end 653 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm ('k') | chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698