| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 13 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 13 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 14 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 14 | 15 |
| 15 class CookiesTreeModelUtil; | 16 class CookiesTreeModelUtil; |
| 16 | 17 |
| 17 namespace settings { | 18 namespace settings { |
| 18 | 19 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 39 void TreeNodeChanged(ui::TreeModel* model, ui::TreeModelNode* node) override { | 40 void TreeNodeChanged(ui::TreeModel* model, ui::TreeModelNode* node) override { |
| 40 } | 41 } |
| 41 void TreeModelBeginBatch(CookiesTreeModel* model) override; | 42 void TreeModelBeginBatch(CookiesTreeModel* model) override; |
| 42 void TreeModelEndBatch(CookiesTreeModel* model) override; | 43 void TreeModelEndBatch(CookiesTreeModel* model) override; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 // Creates the CookiesTreeModel if neccessary. | 46 // Creates the CookiesTreeModel if neccessary. |
| 46 void EnsureCookiesTreeModelCreated(); | 47 void EnsureCookiesTreeModelCreated(); |
| 47 | 48 |
| 48 // Updates search filter for cookies tree model. | 49 // Updates search filter for cookies tree model. |
| 49 void UpdateSearchResults(const base::ListValue* args); | 50 void HandleUpdateSearchResults(const base::ListValue* args); |
| 51 |
| 52 // Retrieve cookie details for a specific site. |
| 53 void HandleGetCookieDetails(const base::ListValue* args); |
| 50 | 54 |
| 51 // Remove all sites data. | 55 // Remove all sites data. |
| 52 void RemoveAll(const base::ListValue* args); | 56 void HandleRemoveAll(const base::ListValue* args); |
| 53 | 57 |
| 54 // Remove selected sites data. | 58 // Remove selected sites data. |
| 55 void Remove(const base::ListValue* args); | 59 void HandleRemove(const base::ListValue* args); |
| 56 | 60 |
| 57 // Get the tree node using the tree path info in |args| and call | 61 // Get the tree node using the tree path info in |args| and call |
| 58 // SendChildren to pass back children nodes data to WebUI. | 62 // SendChildren to pass back children nodes data to WebUI. |
| 59 void LoadChildren(const base::ListValue* args); | 63 void HandleLoadChildren(const base::ListValue* args); |
| 60 | 64 |
| 61 // Get children nodes data and pass it to 'CookiesView.loadChildren' to | 65 // Get children nodes data and pass it to 'CookiesView.loadChildren' to |
| 62 // update the WebUI. | 66 // update the WebUI. |
| 63 void SendChildren(const CookieTreeNode* parent); | 67 void SendChildren(const CookieTreeNode* parent); |
| 64 | 68 |
| 69 // Package and send cookie details for a site. |
| 70 void SendCookieDetails(const CookieTreeNode* parent); |
| 71 |
| 65 // Reloads the CookiesTreeModel and passes the nodes to | 72 // Reloads the CookiesTreeModel and passes the nodes to |
| 66 // 'CookiesView.loadChildren' to update the WebUI. | 73 // 'CookiesView.loadChildren' to update the WebUI. |
| 67 void ReloadCookies(const base::ListValue* args); | 74 void HandleReloadCookies(const base::ListValue* args); |
| 68 | 75 |
| 69 // The Cookies Tree model | 76 // The Cookies Tree model |
| 70 std::unique_ptr<CookiesTreeModel> cookies_tree_model_; | 77 std::unique_ptr<CookiesTreeModel> cookies_tree_model_; |
| 71 | 78 |
| 72 // Flag to indicate whether there is a batch update in progress. | 79 // Flag to indicate whether there is a batch update in progress. |
| 73 bool batch_update_; | 80 bool batch_update_; |
| 74 | 81 |
| 75 std::unique_ptr<CookiesTreeModelUtil> model_util_; | 82 std::unique_ptr<CookiesTreeModelUtil> model_util_; |
| 76 | 83 |
| 77 // The callback ID for the current outstanding request. | 84 // The callback ID for the current outstanding request. |
| 78 std::string callback_id_; | 85 std::string callback_id_; |
| 79 | 86 |
| 80 DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler); | 87 DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler); |
| 81 }; | 88 }; |
| 82 | 89 |
| 83 } // namespace settings | 90 } // namespace settings |
| 84 | 91 |
| 85 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ | 92 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_COOKIES_VIEW_HANDLER_H_ |
| OLD | NEW |