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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/secure_verbose_bubble_decoration.h

Issue 2119033002: [Material][Mac] Implement Omnibox Verbose State Chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the verbose for "NOT SECURE" Created 4 years, 5 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_SECURE_VERBOSE_BUBBLE_DECORATION_H_
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_SECURE_VERBOSE_BUBBLE_DECORATION_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" 11 #include "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h"
12 12
13 // Draws the "Extended Validation SSL" bubble. This will be a lock 13 // Draws the "Extended Validation SSL" bubble. This will be a lock
14 // icon plus a label from the certification, and will replace the 14 // icon plus a label from the certification, and will replace the
15 // location icon for URLs which have an EV cert. The |location_icon| 15 // location icon for URLs which have an EV cert. The |location_icon|
16 // is used to fulfill drag-related calls. 16 // is used to fulfill drag-related calls.
17 17 // In Material Design, it will also draw the secure verbose bubble.
18 // The bubble is exactly the same as the EV bubble, but potentially with a
19 // different security icon and color.
18 // TODO(shess): Refactor to pull the |location_icon| functionality out 20 // TODO(shess): Refactor to pull the |location_icon| functionality out
19 // into a distinct class like views |ClickHandler|. 21 // into a distinct class like views |ClickHandler|.
20 // http://crbug.com/48866 22 // http://crbug.com/48866
21 23
24 class LocationBarViewMac;
22 class LocationIconDecoration; 25 class LocationIconDecoration;
26 @class SecureVerboseAnimation;
23 27
24 class EVBubbleDecoration : public BubbleDecoration { 28 class SecureVerboseBubbleDecoration : public BubbleDecoration {
25 public: 29 public:
26 explicit EVBubbleDecoration(LocationIconDecoration* location_icon); 30 explicit SecureVerboseBubbleDecoration(LocationIconDecoration* location_icon,
27 ~EVBubbleDecoration() override; 31 LocationBarViewMac* owner);
32 ~SecureVerboseBubbleDecoration() override;
28 33
29 // Return the color used to draw the EvBubbleDecoration background in MD. 34 // Return the color used to draw the EvBubbleDecoration background in MD.
30 NSColor* GetBackgroundBorderColor() override; 35 NSColor* GetBackgroundBorderColor() override;
31 36
32 // |GetWidthForSpace()| will set |full_label| as the label, if it 37 // |GetWidthForSpace()| will set |full_label| as the label, if it
33 // fits, else it will set an elided version. 38 // fits, else it will set an elided version.
34 void SetFullLabel(NSString* full_label); 39 void SetFullLabel(NSString* full_label);
35 40
41 // Set the color of the label. If this is not set, the label color will
42 // default to kGoogleGreen700.
43 void SetLabelColor(NSColor* color);
44
45 // Called by SecureVerboseAnimation when the animation has progressed.
46 void OnAnimationProgressed();
47
48 // Starts the animation. If the animation has already started, it will
49 // restart.
50 void StartAnimation();
51
36 // Implement |LocationBarDecoration|. 52 // Implement |LocationBarDecoration|.
37 CGFloat GetWidthForSpace(CGFloat width) override; 53 CGFloat GetWidthForSpace(CGFloat width) override;
38 54
39 // Perform custom drawing for Material Design. 55 // Perform custom drawing for Material Design.
40 void DrawWithBackgroundInFrame(NSRect background_frame, 56 void DrawWithBackgroundInFrame(NSRect background_frame,
41 NSRect frame, 57 NSRect frame,
42 NSView* control_view) override; 58 NSView* control_view) override;
43 59
44 bool IsDraggable() override; 60 bool IsDraggable() override;
45 NSPasteboard* GetDragPasteboard() override; 61 NSPasteboard* GetDragPasteboard() override;
46 NSImage* GetDragImage() override; 62 NSImage* GetDragImage() override;
47 NSRect GetDragImageFrame(NSRect frame) override; 63 NSRect GetDragImageFrame(NSRect frame) override;
48 bool OnMousePressed(NSRect frame, NSPoint location) override; 64 bool OnMousePressed(NSRect frame, NSPoint location) override;
49 bool AcceptsMousePress() override; 65 bool AcceptsMousePress() override;
50 NSPoint GetBubblePointInFrame(NSRect frame) override; 66 NSPoint GetBubblePointInFrame(NSRect frame) override;
51 67
52 // Implement |BubbleDecoration|. 68 // Implement |BubbleDecoration|.
53 ui::NinePartImageIds GetBubbleImageIds() override; 69 ui::NinePartImageIds GetBubbleImageIds() override;
54 70
55 private: 71 private:
56 // The real label. BubbleDecoration's label may be elided. 72 // The real label. BubbleDecoration's label may be elided.
57 base::scoped_nsobject<NSString> full_label_; 73 base::scoped_nsobject<NSString> full_label_;
58 74
75 // The color of the label's text.
76 base::scoped_nsobject<NSColor> label_color_;
77
59 LocationIconDecoration* location_icon_; // weak, owned by location bar. 78 LocationIconDecoration* location_icon_; // weak, owned by location bar.
60 79
61 DISALLOW_COPY_AND_ASSIGN(EVBubbleDecoration); 80 // The animation.
81 base::scoped_nsobject<SecureVerboseAnimation> animation_;
82
83 LocationBarViewMac* owner_; // weak
84
85 DISALLOW_COPY_AND_ASSIGN(SecureVerboseBubbleDecoration);
62 }; 86 };
63 87
64 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 88 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_SECURE_VERBOSE_BUBBLE_DECORATION _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698