| 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_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 int GetCommandIdForExtension(const extensions::Extension& extension); | 61 int GetCommandIdForExtension(const extensions::Extension& extension); |
| 62 | 62 |
| 63 // Gets the extension for a command ID, or NULL if there isn't one. | 63 // Gets the extension for a command ID, or NULL if there isn't one. |
| 64 const extensions::Extension* GetExtensionForCommandId(int command_id); | 64 const extensions::Extension* GetExtensionForCommandId(int command_id); |
| 65 | 65 |
| 66 // content::NotificationObserver implementation. | 66 // content::NotificationObserver implementation. |
| 67 virtual void Observe(int type, | 67 virtual void Observe(int type, |
| 68 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
| 69 const content::NotificationDetails& details) OVERRIDE; | 69 const content::NotificationDetails& details) OVERRIDE; |
| 70 | 70 |
| 71 // Called by the WebIntentsRegistry, returning |services|, which is |
| 72 // a list of WebIntentServiceData matching the query. |
| 73 // Used to populate the menu with share intents on load. |
| 74 void OnWebIntentServicesAvailable( |
| 75 const std::vector<webkit_glue::WebIntentServiceData>& services); |
| 76 |
| 77 // Handles "share with X" commands. |
| 78 void TriggerExplicitShareIntent(const GURL& share_service_url); |
| 79 |
| 80 // Handles the "Find places to share" command. Navigates the browser to the |
| 81 // web store to find extensions with share intents. |
| 82 void NavigateToWebStoreShareIntentsList(); |
| 83 |
| 71 Browser* browser_; | 84 Browser* browser_; |
| 72 | 85 |
| 73 Delegate* delegate_; | 86 Delegate* delegate_; |
| 74 | 87 |
| 75 // The command ID to assign to the next extension that needs one. | 88 // The command ID to assign to the next extension that needs one. |
| 89 int next_share_intent_command_id_; |
| 90 |
| 91 // The share service strings that have commands associated with them. |
| 92 typedef std::map<int, GURL> ShareIntentServiceCommandMap; |
| 93 ShareIntentServiceCommandMap share_intent_service_ids_; |
| 94 |
| 95 // The command ID to assign to the next extension that needs one. |
| 76 int next_extension_command_id_; | 96 int next_extension_command_id_; |
| 77 | 97 |
| 78 // The extension IDs that have commands associated with them. | 98 // The extension IDs that have commands associated with them. |
| 79 typedef std::map<std::string, int> ExtensionIdCommandMap; | 99 typedef std::map<std::string, int> ExtensionIdCommandMap; |
| 80 ExtensionIdCommandMap extension_command_ids_; | 100 ExtensionIdCommandMap extension_command_ids_; |
| 81 | 101 |
| 102 // Weak pointers used for bind()ing intent service callbacks. |
| 103 base::WeakPtrFactory<ActionBoxButtonController> weak_ptr_factory_; |
| 104 |
| 82 content::NotificationRegistrar registrar_; | 105 content::NotificationRegistrar registrar_; |
| 83 | 106 |
| 84 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonController); | 107 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonController); |
| 85 }; | 108 }; |
| 86 | 109 |
| 87 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ | 110 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_ |
| OLD | NEW |