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

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

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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_MANAGE_PASSWORDS_DECORATION_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_MANAGE_PASSWORDS_DECORATION_H_
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_MANAGE_PASSWORDS_DECORATION_H_ 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_MANAGE_PASSWORDS_DECORATION_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" 12 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h"
13 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" 13 #include "chrome/browser/ui/passwords/manage_passwords_icon.h"
14 14
15 class CommandUpdater; 15 class CommandUpdater;
16 class LocationBarViewMac; 16 class LocationBarViewMac;
17 class ManagePasswordsDecoration; 17 class ManagePasswordsDecoration;
18 18
19 // Cocoa implementation of ManagePasswordsIcon that delegates to 19 // Cocoa implementation of ManagePasswordsIcon that delegates to
20 // ManagePasswordsDecoration. 20 // ManagePasswordsDecoration.
21 class ManagePasswordsIconCocoa : public ManagePasswordsIcon { 21 class ManagePasswordsIconCocoa : public ManagePasswordsIcon {
22 public: 22 public:
23 ManagePasswordsIconCocoa(ManagePasswordsDecoration* decoration); 23 ManagePasswordsIconCocoa(ManagePasswordsDecoration* decoration);
24 virtual ~ManagePasswordsIconCocoa(); 24 virtual ~ManagePasswordsIconCocoa();
25 virtual void UpdateVisibleUI() override; 25 void UpdateVisibleUI() override;
26 26
27 int icon_id() { return icon_id_; } 27 int icon_id() { return icon_id_; }
28 int tooltip_text_id() { return tooltip_text_id_; } 28 int tooltip_text_id() { return tooltip_text_id_; }
29 29
30 private: 30 private:
31 ManagePasswordsDecoration* decoration_; // weak, owns us 31 ManagePasswordsDecoration* decoration_; // weak, owns us
32 }; 32 };
33 33
34 // Manage passwords icon on the right side of the field. This appears when 34 // Manage passwords icon on the right side of the field. This appears when
35 // password management is available on the current page. 35 // password management is available on the current page.
36 class ManagePasswordsDecoration : public ImageDecoration { 36 class ManagePasswordsDecoration : public ImageDecoration {
37 public: 37 public:
38 explicit ManagePasswordsDecoration(CommandUpdater* command_updater, 38 explicit ManagePasswordsDecoration(CommandUpdater* command_updater,
39 LocationBarViewMac* location_bar); 39 LocationBarViewMac* location_bar);
40 virtual ~ManagePasswordsDecoration(); 40 ~ManagePasswordsDecoration() override;
41 41
42 // Implement |LocationBarDecoration| 42 // Implement |LocationBarDecoration|
43 virtual bool AcceptsMousePress() override; 43 bool AcceptsMousePress() override;
44 virtual bool OnMousePressed(NSRect frame, NSPoint location) override; 44 bool OnMousePressed(NSRect frame, NSPoint location) override;
45 virtual NSString* GetToolTip() override; 45 NSString* GetToolTip() override;
46 virtual NSPoint GetBubblePointInFrame(NSRect frame) override; 46 NSPoint GetBubblePointInFrame(NSRect frame) override;
47 47
48 // Updates the decoration according to icon state changes. 48 // Updates the decoration according to icon state changes.
49 void UpdateVisibleUI(); 49 void UpdateVisibleUI();
50 50
51 // Accessor for the platform-independent interface. 51 // Accessor for the platform-independent interface.
52 ManagePasswordsIconCocoa* icon() { return icon_.get(); } 52 ManagePasswordsIconCocoa* icon() { return icon_.get(); }
53 53
54 private: 54 private:
55 // Triggers a redraw after a state change. 55 // Triggers a redraw after a state change.
56 void OnChange(); 56 void OnChange();
57 57
58 // Updates child view states. 58 // Updates child view states.
59 void UpdateUIState(); 59 void UpdateUIState();
60 60
61 // Shows the manage passwords bubble. 61 // Shows the manage passwords bubble.
62 CommandUpdater* command_updater_; // Weak, owned by Browser. 62 CommandUpdater* command_updater_; // Weak, owned by Browser.
63 63
64 // Displays all the decorations. 64 // Displays all the decorations.
65 LocationBarViewMac* location_bar_; // Weak, owns us. 65 LocationBarViewMac* location_bar_; // Weak, owns us.
66 66
67 // The platform-independent interface. 67 // The platform-independent interface.
68 scoped_ptr<ManagePasswordsIconCocoa> icon_; 68 scoped_ptr<ManagePasswordsIconCocoa> icon_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsDecoration); 70 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsDecoration);
71 }; 71 };
72 72
73 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_MANAGE_PASSWORDS_DECORATION_H_ 73 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_MANAGE_PASSWORDS_DECORATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698