| 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 #include "chrome/browser/ui/webui/options/web_intents_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/web_intents_settings_handler.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browsing_data_appcache_helper.h" | 9 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 10 #include "chrome/browser/browsing_data_database_helper.h" | 10 #include "chrome/browser/browsing_data_database_helper.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 while (!node->empty()) { | 108 while (!node->empty()) { |
| 109 WebIntentsTreeNode* cnode = node->GetChild(0); | 109 WebIntentsTreeNode* cnode = node->GetChild(0); |
| 110 CHECK(cnode->Type() == WebIntentsTreeNode::TYPE_SERVICE); | 110 CHECK(cnode->Type() == WebIntentsTreeNode::TYPE_SERVICE); |
| 111 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode); | 111 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode); |
| 112 RemoveService(snode); | 112 RemoveService(snode); |
| 113 } | 113 } |
| 114 delete intents_tree_model_->Remove(node->parent(), node); | 114 delete intents_tree_model_->Remove(node->parent(), node); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void WebIntentsSettingsHandler::RemoveService(ServiceTreeNode* snode) { | 117 void WebIntentsSettingsHandler::RemoveService(ServiceTreeNode* snode) { |
| 118 WebIntentData provider; | 118 WebIntentServiceData service; |
| 119 provider.service_url = GURL(snode->ServiceUrl()); | 119 service.service_url = GURL(snode->ServiceUrl()); |
| 120 provider.action = snode->Action(); | 120 service.action = snode->Action(); |
| 121 string16 stype; | 121 string16 stype; |
| 122 if (snode->Types().GetString(0, &stype)) { | 122 if (snode->Types().GetString(0, &stype)) { |
| 123 provider.type = stype; // Really need to iterate here. | 123 service.type = stype; // Really need to iterate here. |
| 124 } | 124 } |
| 125 provider.title = snode->ServiceName(); | 125 service.title = snode->ServiceName(); |
| 126 LOG(INFO) << "Removing service " << snode->ServiceName() | 126 LOG(INFO) << "Removing service " << snode->ServiceName() |
| 127 << " " << snode->ServiceUrl(); | 127 << " " << snode->ServiceUrl(); |
| 128 web_intents_registry_->UnregisterIntentProvider(provider); | 128 web_intents_registry_->UnregisterIntentProvider(service); |
| 129 delete intents_tree_model_->Remove(snode->parent(), snode); | 129 delete intents_tree_model_->Remove(snode->parent(), snode); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void WebIntentsSettingsHandler::LoadChildren(const base::ListValue* args) { | 132 void WebIntentsSettingsHandler::LoadChildren(const base::ListValue* args) { |
| 133 EnsureWebIntentsModelCreated(); | 133 EnsureWebIntentsModelCreated(); |
| 134 | 134 |
| 135 std::string node_path; | 135 std::string node_path; |
| 136 if (!args->GetString(0, &node_path)) { | 136 if (!args->GetString(0, &node_path)) { |
| 137 SendChildren(intents_tree_model_->GetRoot()); | 137 SendChildren(intents_tree_model_->GetRoot()); |
| 138 return; | 138 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 152 children); | 152 children); |
| 153 | 153 |
| 154 ListValue args; | 154 ListValue args; |
| 155 args.Append(parent == intents_tree_model_->GetRoot() ? | 155 args.Append(parent == intents_tree_model_->GetRoot() ? |
| 156 Value::CreateNullValue() : | 156 Value::CreateNullValue() : |
| 157 Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent))); | 157 Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent))); |
| 158 args.Append(children); | 158 args.Append(children); |
| 159 | 159 |
| 160 web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args); | 160 web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args); |
| 161 } | 161 } |
| OLD | NEW |