| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBUI_OPTIONS_INTENTS_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_INTENTS_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/ui/intents/intents_model.h" | 11 #include "chrome/browser/ui/intents/web_intents_model.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui.h" | 12 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 13 | 13 |
| 14 class WebDataService; | 14 class WebDataService; |
| 15 class WebIntentsRegistry; | 15 class WebIntentsRegistry; |
| 16 | 16 |
| 17 // Manage setting up the backing data for the web intents options page. | 17 // Manage setting up the backing data for the web intents options page. |
| 18 class IntentsSettingsHandler : public OptionsPageUIHandler, | 18 class WebIntentsSettingsHandler : public OptionsPageUIHandler, |
| 19 public IntentsModel::Observer { | 19 public WebIntentsModel::Observer { |
| 20 public: | 20 public: |
| 21 IntentsSettingsHandler(); | 21 WebIntentsSettingsHandler(); |
| 22 virtual ~IntentsSettingsHandler(); | 22 virtual ~WebIntentsSettingsHandler(); |
| 23 | 23 |
| 24 // OptionsPageUIHandler implementation. | 24 // OptionsPageUIHandler implementation. |
| 25 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); | 25 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 26 virtual void RegisterMessages(); | 26 virtual void RegisterMessages(); |
| 27 | 27 |
| 28 // IntentsModel::Observer implementation. | 28 // WebIntentsModel::Observer implementation. |
| 29 virtual void TreeNodesAdded(ui::TreeModel* model, | 29 virtual void TreeNodesAdded(ui::TreeModel* model, |
| 30 ui::TreeModelNode* parent, | 30 ui::TreeModelNode* parent, |
| 31 int start, | 31 int start, |
| 32 int count) OVERRIDE; | 32 int count) OVERRIDE; |
| 33 virtual void TreeNodesRemoved(ui::TreeModel* model, | 33 virtual void TreeNodesRemoved(ui::TreeModel* model, |
| 34 ui::TreeModelNode* parent, | 34 ui::TreeModelNode* parent, |
| 35 int start, | 35 int start, |
| 36 int count) OVERRIDE; | 36 int count) OVERRIDE; |
| 37 virtual void TreeNodeChanged(ui::TreeModel* model, | 37 virtual void TreeNodeChanged(ui::TreeModel* model, |
| 38 ui::TreeModelNode* node) OVERRIDE {} | 38 ui::TreeModelNode* node) OVERRIDE {} |
| 39 virtual void TreeModelBeginBatch(IntentsModel* model) OVERRIDE; | 39 virtual void TreeModelBeginBatch(WebIntentsModel* model) OVERRIDE; |
| 40 virtual void TreeModelEndBatch(IntentsModel* model) OVERRIDE; | 40 virtual void TreeModelEndBatch(WebIntentsModel* model) OVERRIDE; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Creates the IntentsModel if neccessary. | 43 // Creates the WebIntentsModel if neccessary. |
| 44 void EnsureIntentsModelCreated(); | 44 void EnsureWebIntentsModelCreated(); |
| 45 | 45 |
| 46 // Updates search filter for cookies tree model. | 46 // Updates search filter for cookies tree model. |
| 47 void UpdateSearchResults(const base::ListValue* args); | 47 void UpdateSearchResults(const base::ListValue* args); |
| 48 | 48 |
| 49 // Remove all sites data. | 49 // Remove all sites data. |
| 50 void RemoveAll(const base::ListValue* args); | 50 void RemoveAll(const base::ListValue* args); |
| 51 | 51 |
| 52 // Remove selected sites data. | 52 // Remove selected sites data. |
| 53 void RemoveIntent(const base::ListValue* args); | 53 void RemoveIntent(const base::ListValue* args); |
| 54 | 54 |
| 55 // Helper functions for removals. | 55 // Helper functions for removals. |
| 56 void RemoveOrigin(IntentsTreeNode* node); | 56 void RemoveOrigin(WebIntentsTreeNode* node); |
| 57 void RemoveService(ServiceTreeNode* snode); | 57 void RemoveService(ServiceTreeNode* snode); |
| 58 | 58 |
| 59 // Trigger for SendChildren to load the JS model. | 59 // Trigger for SendChildren to load the JS model. |
| 60 void LoadChildren(const base::ListValue* args); | 60 void LoadChildren(const base::ListValue* args); |
| 61 | 61 |
| 62 // Get children nodes data and pass it to 'IntentsView.loadChildren' to | 62 // Get children nodes data and pass it to 'IntentsView.loadChildren' to |
| 63 // update the WebUI. | 63 // update the WebUI. |
| 64 void SendChildren(IntentsTreeNode* parent); | 64 void SendChildren(WebIntentsTreeNode* parent); |
| 65 | 65 |
| 66 scoped_refptr<WebDataService> web_data_service_; | 66 scoped_refptr<WebDataService> web_data_service_; |
| 67 WebIntentsRegistry* web_intents_registry_; // Weak pointer. | 67 WebIntentsRegistry* web_intents_registry_; // Weak pointer. |
| 68 | 68 |
| 69 // Backing data model for the intents list. | 69 // Backing data model for the intents list. |
| 70 scoped_ptr<IntentsModel> intents_tree_model_; | 70 scoped_ptr<WebIntentsModel> intents_tree_model_; |
| 71 | 71 |
| 72 // Flag to indicate whether there is a batch update in progress. | 72 // Flag to indicate whether there is a batch update in progress. |
| 73 bool batch_update_; | 73 bool batch_update_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(IntentsSettingsHandler); | 75 DISALLOW_COPY_AND_ASSIGN(WebIntentsSettingsHandler); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_INTENTS_SETTINGS_HANDLER_H_ | 78 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ |
| OLD | NEW |