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

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

Issue 6378009: Only allow extension pages to be displayed in the sidebar to be consistent... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/sidebar/sidebar_container.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 const char kNoSidebarError[] = 30 const char kNoSidebarError[] =
31 "This extension has no sidebar specified."; 31 "This extension has no sidebar specified.";
32 const char kNoTabError[] = "No tab with id: *."; 32 const char kNoTabError[] = "No tab with id: *.";
33 const char kNoCurrentWindowError[] = "No current browser window was found"; 33 const char kNoCurrentWindowError[] = "No current browser window was found";
34 const char kNoDefaultTabError[] = "No default tab was found"; 34 const char kNoDefaultTabError[] = "No default tab was found";
35 const char kInvalidExpandContextError[] = 35 const char kInvalidExpandContextError[] =
36 "Sidebar can be expanded only in response to an explicit user gesture"; 36 "Sidebar can be expanded only in response to an explicit user gesture";
37 // Keys. 37 // Keys.
38 const char kBadgeTextKey[] = "text"; 38 const char kBadgeTextKey[] = "text";
39 const char kImageDataKey[] = "imageData"; 39 const char kImageDataKey[] = "imageData";
40 const char kPathKey[] = "path";
40 const char kStateKey[] = "state"; 41 const char kStateKey[] = "state";
41 const char kTabIdKey[] = "tabId"; 42 const char kTabIdKey[] = "tabId";
42 const char kTitleKey[] = "title"; 43 const char kTitleKey[] = "title";
43 const char kUrlKey[] = "url";
44 // Events. 44 // Events.
45 const char kOnStateChanged[] = "experimental.sidebar.onStateChanged"; 45 const char kOnStateChanged[] = "experimental.sidebar.onStateChanged";
46 } // namespace 46 } // namespace
47 47
48 namespace extension_sidebar_constants { 48 namespace extension_sidebar_constants {
49 // Sidebar states. 49 // Sidebar states.
50 const char kActiveState[] = "active"; 50 const char kActiveState[] = "active";
51 const char kHiddenState[] = "hidden"; 51 const char kHiddenState[] = "hidden";
52 const char kShownState[] = "shown"; 52 const char kShownState[] = "shown";
53 } // namespace extension_sidebar_constants 53 } // namespace extension_sidebar_constants
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 bool HideSidebarFunction::RunImpl(TabContents* tab, 197 bool HideSidebarFunction::RunImpl(TabContents* tab,
198 const std::string& content_id, 198 const std::string& content_id,
199 const DictionaryValue& details) { 199 const DictionaryValue& details) {
200 SidebarManager::GetInstance()->HideSidebar(tab, content_id); 200 SidebarManager::GetInstance()->HideSidebar(tab, content_id);
201 return true; 201 return true;
202 } 202 }
203 203
204 bool NavigateSidebarFunction::RunImpl(TabContents* tab, 204 bool NavigateSidebarFunction::RunImpl(TabContents* tab,
205 const std::string& content_id, 205 const std::string& content_id,
206 const DictionaryValue& details) { 206 const DictionaryValue& details) {
207 std::string url_string; 207 std::string path_string;
208 EXTENSION_FUNCTION_VALIDATE(details.GetString(kUrlKey, &url_string)); 208 EXTENSION_FUNCTION_VALIDATE(details.GetString(kPathKey, &path_string));
209 209
210 GURL url = extension_sidebar_utils::ResolveAndVerifyUrl( 210 GURL url = extension_sidebar_utils::ResolveRelativePath(
211 url_string, GetExtension(), &error_); 211 path_string, GetExtension(), &error_);
212 if (!url.is_valid()) 212 if (!url.is_valid())
213 return false; 213 return false;
214 214
215 SidebarManager::GetInstance()->NavigateSidebar(tab, content_id, url); 215 SidebarManager::GetInstance()->NavigateSidebar(tab, content_id, url);
216 return true; 216 return true;
217 } 217 }
218 218
219 bool SetBadgeTextSidebarFunction::RunImpl(TabContents* tab, 219 bool SetBadgeTextSidebarFunction::RunImpl(TabContents* tab,
220 const std::string& content_id, 220 const std::string& content_id,
221 const DictionaryValue& details) { 221 const DictionaryValue& details) {
(...skipping 26 matching lines...) Expand all
248 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); 248 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title);
249 return true; 249 return true;
250 } 250 }
251 251
252 bool ShowSidebarFunction::RunImpl(TabContents* tab, 252 bool ShowSidebarFunction::RunImpl(TabContents* tab,
253 const std::string& content_id, 253 const std::string& content_id,
254 const DictionaryValue& details) { 254 const DictionaryValue& details) {
255 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); 255 SidebarManager::GetInstance()->ShowSidebar(tab, content_id);
256 return true; 256 return true;
257 } 257 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/sidebar/sidebar_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698