OLD | NEW |
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_CONTENT_SETTING_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CONTENT_SETTING_DECORATION_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CONTENT_SETTING_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CONTENT_SETTING_DECORATION_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #import "chrome/browser/ui/cocoa/location_bar/image_decoration.h" | 9 #import "chrome/browser/ui/cocoa/location_bar/image_decoration.h" |
10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
11 | 11 |
12 // ContentSettingDecoration is used to display the content settings | 12 // ContentSettingDecoration is used to display the content settings |
13 // images on the current page. | 13 // images on the current page. |
14 | 14 |
15 @class ContentSettingAnimationState; | 15 @class ContentSettingAnimationState; |
16 class ContentSettingImageModel; | 16 class ContentSettingImageModel; |
17 class LocationBarViewMac; | 17 class LocationBarViewMac; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 class ContentSettingDecoration : public ImageDecoration { | 24 class ContentSettingDecoration : public ImageDecoration { |
25 public: | 25 public: |
26 ContentSettingDecoration(ContentSettingsType settings_type, | 26 ContentSettingDecoration(ContentSettingsType settings_type, |
27 LocationBarViewMac* owner, | 27 LocationBarViewMac* owner, |
28 Profile* profile); | 28 Profile* profile); |
29 virtual ~ContentSettingDecoration(); | 29 ~ContentSettingDecoration() override; |
30 | 30 |
31 // Updates the image and visibility state based on the supplied WebContents. | 31 // Updates the image and visibility state based on the supplied WebContents. |
32 // Returns true if the decoration's visible state changed. | 32 // Returns true if the decoration's visible state changed. |
33 bool UpdateFromWebContents(content::WebContents* web_contents); | 33 bool UpdateFromWebContents(content::WebContents* web_contents); |
34 | 34 |
35 // Overridden from |LocationBarDecoration| | 35 // Overridden from |LocationBarDecoration| |
36 virtual bool AcceptsMousePress() override; | 36 bool AcceptsMousePress() override; |
37 virtual bool OnMousePressed(NSRect frame, NSPoint location) override; | 37 bool OnMousePressed(NSRect frame, NSPoint location) override; |
38 virtual NSString* GetToolTip() override; | 38 NSString* GetToolTip() override; |
39 virtual CGFloat GetWidthForSpace(CGFloat width) override; | 39 CGFloat GetWidthForSpace(CGFloat width) override; |
40 virtual void DrawInFrame(NSRect frame, NSView* control_view) override; | 40 void DrawInFrame(NSRect frame, NSView* control_view) override; |
41 virtual NSPoint GetBubblePointInFrame(NSRect frame) override; | 41 NSPoint GetBubblePointInFrame(NSRect frame) override; |
42 | 42 |
43 // Called from internal animator. Only public because ObjC objects can't | 43 // Called from internal animator. Only public because ObjC objects can't |
44 // be friends. | 44 // be friends. |
45 virtual void AnimationTimerFired(); | 45 virtual void AnimationTimerFired(); |
46 | 46 |
47 private: | 47 private: |
48 | 48 |
49 void SetToolTip(NSString* tooltip); | 49 void SetToolTip(NSString* tooltip); |
50 | 50 |
51 // Returns an attributed string with the animated text. | 51 // Returns an attributed string with the animated text. |
(...skipping 11 matching lines...) Expand all Loading... |
63 | 63 |
64 // Used when the decoration has animated text. | 64 // Used when the decoration has animated text. |
65 base::scoped_nsobject<ContentSettingAnimationState> animation_; | 65 base::scoped_nsobject<ContentSettingAnimationState> animation_; |
66 CGFloat text_width_; | 66 CGFloat text_width_; |
67 base::scoped_nsobject<NSAttributedString> animated_text_; | 67 base::scoped_nsobject<NSAttributedString> animated_text_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(ContentSettingDecoration); | 69 DISALLOW_COPY_AND_ASSIGN(ContentSettingDecoration); |
70 }; | 70 }; |
71 | 71 |
72 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CONTENT_SETTING_DECORATION_H_ | 72 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CONTENT_SETTING_DECORATION_H_ |
OLD | NEW |