OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMAND_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_COMMAND_UPDATER_H_ |
6 #define CHROME_BROWSER_COMMAND_UPDATER_H_ | 6 #define CHROME_BROWSER_COMMAND_UPDATER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "ui/base/window_open_disposition.h" | 10 #include "ui/base/window_open_disposition.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 | 55 |
56 // Removes |observer| for all commands on which it's registered. | 56 // Removes |observer| for all commands on which it's registered. |
57 void RemoveCommandObserver(CommandObserver* observer); | 57 void RemoveCommandObserver(CommandObserver* observer); |
58 | 58 |
59 // Notify all observers of a particular command that the command has been | 59 // Notify all observers of a particular command that the command has been |
60 // enabled or disabled. If the command does not exist, it is created and | 60 // enabled or disabled. If the command does not exist, it is created and |
61 // initialized to |state|. This function is very lightweight if the command | 61 // initialized to |state|. This function is very lightweight if the command |
62 // state has not changed. | 62 // state has not changed. |
63 void UpdateCommandEnabled(int id, bool state); | 63 void UpdateCommandEnabled(int id, bool state); |
64 | 64 |
65 void set_bookmark_icon_selected(bool selection) { | |
Avi (use Gerrit)
2014/11/28 14:56:07
You need to have some comments explaining the mean
| |
66 bookmark_icon_selection_ = selection; | |
67 } | |
68 | |
69 bool get_bookmark_icon_selected() { return bookmark_icon_selection_; } | |
70 | |
65 private: | 71 private: |
66 // A piece of data about a command - whether or not it is enabled, and a list | 72 // A piece of data about a command - whether or not it is enabled, and a list |
67 // of objects that observe the enabled state of this command. | 73 // of objects that observe the enabled state of this command. |
68 class Command; | 74 class Command; |
69 | 75 |
70 // Get a Command node for a given command ID, creating an entry if it doesn't | 76 // Get a Command node for a given command ID, creating an entry if it doesn't |
71 // exist if desired. | 77 // exist if desired. |
72 Command* GetCommand(int id, bool create); | 78 Command* GetCommand(int id, bool create); |
73 | 79 |
74 // The delegate is responsible for executing commands. | 80 // The delegate is responsible for executing commands. |
75 CommandUpdaterDelegate* delegate_; | 81 CommandUpdaterDelegate* delegate_; |
76 | 82 |
77 // This is a map of command IDs to states and observer lists | 83 // This is a map of command IDs to states and observer lists |
78 typedef base::hash_map<int, Command*> CommandMap; | 84 typedef base::hash_map<int, Command*> CommandMap; |
79 CommandMap commands_; | 85 CommandMap commands_; |
80 | 86 |
87 bool bookmark_icon_selection_; | |
88 | |
81 DISALLOW_COPY_AND_ASSIGN(CommandUpdater); | 89 DISALLOW_COPY_AND_ASSIGN(CommandUpdater); |
82 }; | 90 }; |
83 | 91 |
84 #endif // CHROME_BROWSER_COMMAND_UPDATER_H_ | 92 #endif // CHROME_BROWSER_COMMAND_UPDATER_H_ |
OLD | NEW |