| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extension_bookmark_manager_api.h" | 5 #include "chrome/browser/extensions/extension_bookmark_manager_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ExtensionBookmarkManagerEventRouter::DispatchEvent(const char* event_name, | 156 void ExtensionBookmarkManagerEventRouter::DispatchEvent(const char* event_name, |
| 157 const ListValue* args) { | 157 const ListValue* args) { |
| 158 if (!profile_->GetExtensionMessageService()) | 158 if (!profile_->GetExtensionMessageService()) |
| 159 return; | 159 return; |
| 160 | 160 |
| 161 std::string json_args; | 161 std::string json_args; |
| 162 base::JSONWriter::Write(args, false, &json_args); | 162 base::JSONWriter::Write(args, false, &json_args); |
| 163 profile_->GetExtensionMessageService()->DispatchEventToRenderers( | 163 profile_->GetExtensionMessageService()->DispatchEventToRenderers( |
| 164 event_name, json_args, profile_->IsOffTheRecord(), GURL()); | 164 event_name, json_args, profile_, GURL()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ExtensionBookmarkManagerEventRouter::DispatchDragEvent( | 167 void ExtensionBookmarkManagerEventRouter::DispatchDragEvent( |
| 168 const BookmarkDragData& data, const char* event_name) { | 168 const BookmarkDragData& data, const char* event_name) { |
| 169 if (data.size() == 0) | 169 if (data.size() == 0) |
| 170 return; | 170 return; |
| 171 | 171 |
| 172 ListValue args; | 172 ListValue args; |
| 173 BookmarkDragDataToJSON(profile_, data, &args); | 173 BookmarkDragDataToJSON(profile_, data, &args); |
| 174 DispatchEvent(event_name, &args); | 174 DispatchEvent(event_name, &args); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (folders_only) { | 431 if (folders_only) { |
| 432 extension_bookmark_helpers::AddNodeFoldersOnly(node, | 432 extension_bookmark_helpers::AddNodeFoldersOnly(node, |
| 433 json.get(), | 433 json.get(), |
| 434 true); | 434 true); |
| 435 } else { | 435 } else { |
| 436 extension_bookmark_helpers::AddNode(node, json.get(), true); | 436 extension_bookmark_helpers::AddNode(node, json.get(), true); |
| 437 } | 437 } |
| 438 result_.reset(json.release()); | 438 result_.reset(json.release()); |
| 439 return true; | 439 return true; |
| 440 } | 440 } |
| OLD | NEW |