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

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

Issue 2511043002: [Mac] Omnibox icons active states (Closed)
Patch Set: Cleaned up Created 4 years, 1 month 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"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 DCHECK(view); 205 DCHECK(view);
206 return view; 206 return view;
207 } 207 }
208 208
209 - (const TranslateBubbleModel*)model { 209 - (const TranslateBubbleModel*)model {
210 return model_.get(); 210 return model_.get();
211 } 211 }
212 212
213 - (void)showWindow:(id)sender { 213 - (void)showWindow:(id)sender {
214 BrowserWindowController* controller = [[self parentWindow] windowController]; 214 BrowserWindowController* controller = [[self parentWindow] windowController];
215 NSPoint anchorPoint = [[controller toolbarController] translateBubblePoint]; 215 NSPoint anchorPoint = [[controller toolbarController]
216 bubblePointForDecoration:[self decorationForBubble]];
216 anchorPoint = 217 anchorPoint =
217 ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint); 218 ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint);
218 [self setAnchorPoint:anchorPoint]; 219 [self setAnchorPoint:anchorPoint];
219 [super showWindow:sender]; 220 [super showWindow:sender];
220 } 221 }
221 222
223 - (LocationBarDecoration*)decorationForBubble {
224 BrowserWindowController* controller = [[self parentWindow] windowController];
225 return [[controller toolbarController] translateDecoration];
226 }
227
222 - (void)switchView:(TranslateBubbleModel::ViewState)viewState { 228 - (void)switchView:(TranslateBubbleModel::ViewState)viewState {
223 if (model_->GetViewState() == viewState) 229 if (model_->GetViewState() == viewState)
224 return; 230 return;
225 231
226 model_->SetViewState(viewState); 232 model_->SetViewState(viewState);
227 [self performLayout]; 233 [self performLayout];
228 } 234 }
229 235
230 - (void)switchToErrorView:(translate::TranslateErrors::Type)errorType { 236 - (void)switchToErrorView:(translate::TranslateErrors::Type)errorType {
231 [self switchView:TranslateBubbleModel::VIEW_STATE_ERROR]; 237 [self switchView:TranslateBubbleModel::VIEW_STATE_ERROR];
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 // source or target language on the before translate view. 885 // source or target language on the before translate view.
880 - (BOOL)textView:(NSTextView*)aTextView 886 - (BOOL)textView:(NSTextView*)aTextView
881 clickedOnLink:(id)link 887 clickedOnLink:(id)link
882 atIndex:(NSUInteger)charIndex { 888 atIndex:(NSUInteger)charIndex {
883 translate::ReportUiAction(translate::ADVANCED_LINK_CLICKED); 889 translate::ReportUiAction(translate::ADVANCED_LINK_CLICKED);
884 [self switchView:TranslateBubbleModel::VIEW_STATE_ADVANCED]; 890 [self switchView:TranslateBubbleModel::VIEW_STATE_ADVANCED];
885 return YES; 891 return YES;
886 } 892 }
887 893
888 @end 894 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698