Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/extensions/extension_sidebar_api.cc

Issue 3212005: Unify sidebar identification in the chrome.experimental.sidebar extension API... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_sidebar_api.h ('k') | chrome/browser/sidebar/sidebar_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698