OLD | NEW |
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 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Origin chip button, which is placed leading the omnibox and contains the | 23 // Origin chip button, which is placed leading the omnibox and contains the |
24 // current site's host. Clicking the chip reveals the page's URL, and clicking | 24 // current site's host. Clicking the chip reveals the page's URL, and clicking |
25 // the icon on the chip reveals the permissions bubble. | 25 // the icon on the chip reveals the permissions bubble. |
26 class OriginChipDecoration : public ButtonDecoration, | 26 class OriginChipDecoration : public ButtonDecoration, |
27 public extensions::IconImage::Observer, | 27 public extensions::IconImage::Observer, |
28 public SafeBrowsingUIManager::Observer { | 28 public SafeBrowsingUIManager::Observer { |
29 public: | 29 public: |
30 OriginChipDecoration(LocationBarViewMac* owner, | 30 OriginChipDecoration(LocationBarViewMac* owner, |
31 LocationIconDecoration* location_icon); | 31 LocationIconDecoration* location_icon); |
32 virtual ~OriginChipDecoration(); | 32 ~OriginChipDecoration() override; |
33 | 33 |
34 // Updates the origin chip's content, and display state. | 34 // Updates the origin chip's content, and display state. |
35 void Update(); | 35 void Update(); |
36 | 36 |
37 // Implement |ButtonDecoration|. | 37 // Implement |ButtonDecoration|. |
38 virtual bool PreventFocus(NSPoint location) const override; | 38 bool PreventFocus(NSPoint location) const override; |
39 | 39 |
40 // Implement |LocationBarDecoration|. | 40 // Implement |LocationBarDecoration|. |
41 virtual CGFloat GetWidthForSpace(CGFloat width) override; | 41 CGFloat GetWidthForSpace(CGFloat width) override; |
42 virtual void DrawInFrame(NSRect frame, NSView* control_view) override; | 42 void DrawInFrame(NSRect frame, NSView* control_view) override; |
43 virtual NSString* GetToolTip() override; | 43 NSString* GetToolTip() override; |
44 virtual bool OnMousePressed(NSRect frame, NSPoint location) override; | 44 bool OnMousePressed(NSRect frame, NSPoint location) override; |
45 virtual NSPoint GetBubblePointInFrame(NSRect frame) override; | 45 NSPoint GetBubblePointInFrame(NSRect frame) override; |
46 | 46 |
47 // Implement |IconImage::Observer|. | 47 // Implement |IconImage::Observer|. |
48 virtual void OnExtensionIconImageChanged( | 48 void OnExtensionIconImageChanged(extensions::IconImage* image) override; |
49 extensions::IconImage* image) override; | |
50 | 49 |
51 // Implement |SafeBrowsingUIManager::Observer|. | 50 // Implement |SafeBrowsingUIManager::Observer|. |
52 virtual void OnSafeBrowsingHit( | 51 void OnSafeBrowsingHit( |
53 const SafeBrowsingUIManager::UnsafeResource& resource) override; | 52 const SafeBrowsingUIManager::UnsafeResource& resource) override; |
54 virtual void OnSafeBrowsingMatch( | 53 void OnSafeBrowsingMatch( |
55 const SafeBrowsingUIManager::UnsafeResource& resource) override; | 54 const SafeBrowsingUIManager::UnsafeResource& resource) override; |
56 | 55 |
57 private: | 56 private: |
58 // Returns the width required to display the chip's contents. | 57 // Returns the width required to display the chip's contents. |
59 CGFloat GetChipWidth() const; | 58 CGFloat GetChipWidth() const; |
60 | 59 |
61 // Contains attributes for drawing the origin string. | 60 // Contains attributes for drawing the origin string. |
62 base::scoped_nsobject<NSMutableDictionary> attributes_; | 61 base::scoped_nsobject<NSMutableDictionary> attributes_; |
63 | 62 |
64 // The extension's current icon, if the page being displayed belongs to an | 63 // The extension's current icon, if the page being displayed belongs to an |
(...skipping 13 matching lines...) Expand all Loading... |
78 // The location icon decoration. Weak. | 77 // The location icon decoration. Weak. |
79 LocationIconDecoration* location_icon_; | 78 LocationIconDecoration* location_icon_; |
80 | 79 |
81 // The control view that owns this. Weak. | 80 // The control view that owns this. Weak. |
82 LocationBarViewMac* owner_; | 81 LocationBarViewMac* owner_; |
83 | 82 |
84 DISALLOW_COPY_AND_ASSIGN(OriginChipDecoration); | 83 DISALLOW_COPY_AND_ASSIGN(OriginChipDecoration); |
85 }; | 84 }; |
86 | 85 |
87 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ | 86 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ORIGIN_CHIP_DECORATION_H_ |
OLD | NEW |