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_TRANSLATE_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_TRANSLATE_DECORATION_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_TRANSLATE_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_TRANSLATE_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/image_decoration.h" | 11 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" |
12 | 12 |
13 class CommandUpdater; | 13 class CommandUpdater; |
14 @class TranslateBubbleController; | 14 @class TranslateBubbleController; |
15 | 15 |
16 // Translate icon on the right side of the field. This appears when | 16 // Translate icon on the right side of the field. This appears when |
17 // translation is available on the current page. This icon is lit when | 17 // translation is available on the current page. This icon is lit when |
18 // translation is already done, otherwise not lit. | 18 // translation is already done, otherwise not lit. |
19 class TranslateDecoration : public ImageDecoration { | 19 class TranslateDecoration : public ImageDecoration { |
20 public: | 20 public: |
21 explicit TranslateDecoration(CommandUpdater* command_updater); | 21 explicit TranslateDecoration(CommandUpdater* command_updater); |
22 ~TranslateDecoration() override; | 22 ~TranslateDecoration() override; |
23 | 23 |
24 // Toggles the icon on or off. | 24 // Toggles the icon on or off. |
25 void SetLit(bool on); | 25 void SetLit(bool on, bool locationBarIsDark); |
26 | 26 |
27 // Implement |LocationBarDecoration| | 27 // Implement |LocationBarDecoration| |
28 bool AcceptsMousePress() override; | 28 bool AcceptsMousePress() override; |
29 bool OnMousePressed(NSRect frame, NSPoint location) override; | 29 bool OnMousePressed(NSRect frame, NSPoint location) override; |
30 NSString* GetToolTip() override; | 30 NSString* GetToolTip() override; |
31 NSPoint GetBubblePointInFrame(NSRect frame) override; | 31 NSPoint GetBubblePointInFrame(NSRect frame) override; |
32 | 32 |
33 private: | 33 private: |
34 // For showing the translate bubble up. | 34 // For showing the translate bubble up. |
35 CommandUpdater* command_updater_; // Weak, owned by Browser. | 35 CommandUpdater* command_updater_; // Weak, owned by Browser. |
36 | 36 |
37 DISALLOW_COPY_AND_ASSIGN(TranslateDecoration); | 37 DISALLOW_COPY_AND_ASSIGN(TranslateDecoration); |
38 }; | 38 }; |
39 | 39 |
40 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_TRANSLATE_DECORATION_H_ | 40 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_TRANSLATE_DECORATION_H_ |
OLD | NEW |