| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 *error = ExtensionErrorUtils::FormatErrorMessage( | 69 *error = ExtensionErrorUtils::FormatErrorMessage( |
| 70 extension_manifest_errors::kCannotAccessPage, url.spec()); | 70 extension_manifest_errors::kCannotAccessPage, url.spec()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 // static | 77 // static |
| 78 void ExtensionSidebarEventRouter::OnStateChanged( | 78 void ExtensionSidebarEventRouter::OnStateChanged( |
| 79 Profile* profile, int tab_id, const std::string& content_id, | 79 Profile* profile, TabContents* tab, const std::string& content_id, |
| 80 const std::string& state) { | 80 const std::string& state) { |
| 81 int tab_id = ExtensionTabUtil::GetTabId(tab); |
| 81 DictionaryValue* details = new DictionaryValue; | 82 DictionaryValue* details = new DictionaryValue; |
| 82 details->Set(kTabIdKey, Value::CreateIntegerValue(tab_id)); | 83 details->Set(kTabIdKey, Value::CreateIntegerValue(tab_id)); |
| 83 details->Set(kStateKey, Value::CreateStringValue(state)); | 84 details->Set(kStateKey, Value::CreateStringValue(state)); |
| 84 | 85 |
| 85 ListValue args; | 86 ListValue args; |
| 86 args.Set(0, details); | 87 args.Set(0, details); |
| 87 std::string json_args; | 88 std::string json_args; |
| 88 base::JSONWriter::Write(&args, false, &json_args); | 89 base::JSONWriter::Write(&args, false, &json_args); |
| 89 | 90 |
| 90 const std::string& extension_id(content_id); | 91 const std::string& extension_id(content_id); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); | 262 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); |
| 262 return true; | 263 return true; |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool ShowSidebarFunction::RunImpl(TabContents* tab, | 266 bool ShowSidebarFunction::RunImpl(TabContents* tab, |
| 266 const std::string& content_id, | 267 const std::string& content_id, |
| 267 const DictionaryValue& details) { | 268 const DictionaryValue& details) { |
| 268 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); | 269 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); |
| 269 return true; | 270 return true; |
| 270 } | 271 } |
| OLD | NEW |