| 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_sidebar_api.h" | 5 #include "chrome/browser/extensions/extension_sidebar_api.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 details->Set(kTabIdKey, Value::CreateIntegerValue(tab_id)); | 82 details->Set(kTabIdKey, Value::CreateIntegerValue(tab_id)); |
| 83 details->Set(kStateKey, Value::CreateStringValue(state)); | 83 details->Set(kStateKey, Value::CreateStringValue(state)); |
| 84 | 84 |
| 85 ListValue args; | 85 ListValue args; |
| 86 args.Set(0, details); | 86 args.Set(0, details); |
| 87 std::string json_args; | 87 std::string json_args; |
| 88 base::JSONWriter::Write(&args, false, &json_args); | 88 base::JSONWriter::Write(&args, false, &json_args); |
| 89 | 89 |
| 90 const std::string& extension_id(content_id); | 90 const std::string& extension_id(content_id); |
| 91 profile->GetExtensionMessageService()->DispatchEventToExtension( | 91 profile->GetExtensionMessageService()->DispatchEventToExtension( |
| 92 extension_id, kOnStateChanged, json_args, | 92 extension_id, kOnStateChanged, json_args, profile, GURL()); |
| 93 profile->IsOffTheRecord(), GURL()); | |
| 94 } | 93 } |
| 95 | 94 |
| 96 | 95 |
| 97 bool SidebarFunction::RunImpl() { | 96 bool SidebarFunction::RunImpl() { |
| 98 if (!args_.get()) | 97 if (!args_.get()) |
| 99 return false; | 98 return false; |
| 100 | 99 |
| 101 DictionaryValue* details = NULL; | 100 DictionaryValue* details = NULL; |
| 102 DictionaryValue default_details; | 101 DictionaryValue default_details; |
| 103 if (args_->empty()) { | 102 if (args_->empty()) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); | 260 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); |
| 262 return true; | 261 return true; |
| 263 } | 262 } |
| 264 | 263 |
| 265 bool ShowSidebarFunction::RunImpl(TabContents* tab, | 264 bool ShowSidebarFunction::RunImpl(TabContents* tab, |
| 266 const std::string& content_id, | 265 const std::string& content_id, |
| 267 const DictionaryValue& details) { | 266 const DictionaryValue& details) { |
| 268 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); | 267 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); |
| 269 return true; | 268 return true; |
| 270 } | 269 } |
| OLD | NEW |