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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm

Issue 2542173002: [Mac] Omnibox icons active states (Closed)
Patch Set: Created 4 years 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 (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/location_bar/content_setting_decoration.h" 5 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 if (chrome::ToolkitViewsDialogsEnabled()) { 306 if (chrome::ToolkitViewsDialogsEnabled()) {
307 gfx::Point origin = gfx::ScreenPointFromNSPoint(anchor); 307 gfx::Point origin = gfx::ScreenPointFromNSPoint(anchor);
308 chrome::ContentSettingBubbleViewsBridge::Show( 308 chrome::ContentSettingBubbleViewsBridge::Show(
309 [web_contents->GetTopLevelNativeWindow() contentView], 309 [web_contents->GetTopLevelNativeWindow() contentView],
310 model, web_contents, origin); 310 model, web_contents, origin);
311 } else { 311 } else {
312 [ContentSettingBubbleController showForModel:model 312 [ContentSettingBubbleController showForModel:model
313 webContents:web_contents 313 webContents:web_contents
314 parentWindow:[field window] 314 parentWindow:[field window]
315 decoration:this
315 anchoredAt:anchor]; 316 anchoredAt:anchor];
316 } 317 }
317 318
318 return true; 319 return true;
319 } 320 }
320 321
321 NSString* ContentSettingDecoration::GetToolTip() { 322 NSString* ContentSettingDecoration::GetToolTip() {
322 return tooltip_.get(); 323 return tooltip_.get();
323 } 324 }
324 325
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 ImageDecoration::DrawInFrame(icon_rect, control_view); 380 ImageDecoration::DrawInFrame(icon_rect, control_view);
380 } 381 }
381 382
382 NSRect remainder = frame; 383 NSRect remainder = frame;
383 remainder.origin.x = NSMaxX(icon_rect) + kTextMarginPadding; 384 remainder.origin.x = NSMaxX(icon_rect) + kTextMarginPadding;
384 remainder.size.width = 385 remainder.size.width =
385 NSMaxX(background_rect) - NSMinX(remainder) - kTextDividerPadding; 386 NSMaxX(background_rect) - NSMinX(remainder) - kTextDividerPadding;
386 DrawAttributedString(animated_text_, remainder); 387 DrawAttributedString(animated_text_, remainder);
387 388
388 // Draw the divider if available. 389 // Draw the divider if available.
389 if (state() == LocationBarDecorationState::NORMAL) { 390 if (state() == DecorationMouseState::NONE && !active()) {
390 NSBezierPath* line = [NSBezierPath bezierPath]; 391 NSBezierPath* line = [NSBezierPath bezierPath];
391 [line setLineWidth:1]; 392 [line setLineWidth:1];
392 [line moveToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding, 393 [line moveToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding,
393 NSMinY(background_rect))]; 394 NSMinY(background_rect))];
394 [line lineToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding, 395 [line lineToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding,
395 NSMaxY(background_rect))]; 396 NSMaxY(background_rect))];
396 [GetDividerColor(owner_->IsLocationBarDark()) set]; 397 [GetDividerColor(owner_->IsLocationBarDark()) set];
397 [line stroke]; 398 [line stroke];
398 } 399 }
399 } else { 400 } else {
400 // No animation, draw the image as normal. 401 // No animation, draw the image as normal.
401 ImageDecoration::DrawInFrame(frame, control_view); 402 ImageDecoration::DrawInFrame(frame, control_view);
402 } 403 }
403 } 404 }
404 405
405 void ContentSettingDecoration::AnimationTimerFired() { 406 void ContentSettingDecoration::AnimationTimerFired() {
406 owner_->Layout(); 407 owner_->Layout();
407 // Even after the animation completes, the |animator_| object should be kept 408 // Even after the animation completes, the |animator_| object should be kept
408 // alive to prevent the animation from re-appearing if the page opens 409 // alive to prevent the animation from re-appearing if the page opens
409 // additional popups later. The animator will be cleared when the decoration 410 // additional popups later. The animator will be cleared when the decoration
410 // hides, indicating something has changed with the WebContents (probably 411 // hides, indicating something has changed with the WebContents (probably
411 // navigation). 412 // navigation).
412 } 413 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698