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

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

Issue 14651017: Move RuntimeData and related permissions out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_permissions
Patch Set: Latest master Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
8 #include "chrome/browser/extensions/shell_window_registry.h" 8 #include "chrome/browser/extensions/shell_window_registry.h"
9 #include "chrome/browser/extensions/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/extensions/window_controller.h" 10 #include "chrome/browser/extensions/window_controller.h"
11 #include "chrome/browser/extensions/window_controller_list.h" 11 #include "chrome/browser/extensions/window_controller_list.h"
12 #include "chrome/browser/net/url_fixer_upper.h" 12 #include "chrome/browser/net/url_fixer_upper.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sessions/session_id.h" 14 #include "chrome/browser/sessions/session_id.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_iterator.h" 17 #include "chrome/browser/ui/browser_iterator.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/extensions/shell_window.h" 19 #include "chrome/browser/ui/extensions/shell_window.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 20 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_manifest_constants.h" 23 #include "chrome/common/extensions/extension_manifest_constants.h"
24 #include "chrome/common/extensions/manifest_url_handler.h" 24 #include "chrome/common/extensions/manifest_url_handler.h"
25 #include "chrome/common/extensions/permissions/api_permission.h" 25 #include "chrome/common/extensions/permissions/api_permission.h"
26 #include "chrome/common/extensions/permissions/permissions_data.h"
26 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
27 #include "content/public/browser/favicon_status.h" 28 #include "content/public/browser/favicon_status.h"
28 #include "content/public/browser/navigation_entry.h" 29 #include "content/public/browser/navigation_entry.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
31 32
32 namespace keys = extensions::tabs_constants; 33 namespace keys = extensions::tabs_constants;
33 namespace tabs = extensions::api::tabs; 34 namespace tabs = extensions::api::tabs;
34 35
35 using content::NavigationEntry; 36 using content::NavigationEntry;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (opener) 159 if (opener)
159 result->SetInteger(keys::kOpenerTabIdKey, GetTabId(opener)); 160 result->SetInteger(keys::kOpenerTabIdKey, GetTabId(opener));
160 } 161 }
161 162
162 return result; 163 return result;
163 } 164 }
164 165
165 void ExtensionTabUtil::ScrubTabValueForExtension(const WebContents* contents, 166 void ExtensionTabUtil::ScrubTabValueForExtension(const WebContents* contents,
166 const Extension* extension, 167 const Extension* extension,
167 DictionaryValue* tab_info) { 168 DictionaryValue* tab_info) {
168 bool has_permission = extension && extension->HasAPIPermissionForTab( 169 bool has_permission =
169 GetTabId(contents), APIPermission::kTab); 170 extension &&
171 extensions::PermissionsData::HasAPIPermissionForTab(
172 extension, GetTabId(contents), APIPermission::kTab);
170 173
171 if (!has_permission) { 174 if (!has_permission) {
172 tab_info->Remove(keys::kUrlKey, NULL); 175 tab_info->Remove(keys::kUrlKey, NULL);
173 tab_info->Remove(keys::kTitleKey, NULL); 176 tab_info->Remove(keys::kTitleKey, NULL);
174 tab_info->Remove(keys::kFaviconUrlKey, NULL); 177 tab_info->Remove(keys::kFaviconUrlKey, NULL);
175 } 178 }
176 } 179 }
177 180
178 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension, 181 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension,
179 tabs::Tab* tab) { 182 tabs::Tab* tab) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 content::OpenURLParams params( 342 content::OpenURLParams params(
340 extensions::ManifestURL::GetOptionsPage(extension), 343 extensions::ManifestURL::GetOptionsPage(extension),
341 content::Referrer(), SINGLETON_TAB, 344 content::Referrer(), SINGLETON_TAB,
342 content::PAGE_TRANSITION_LINK, false); 345 content::PAGE_TRANSITION_LINK, false);
343 browser->OpenURL(params); 346 browser->OpenURL(params);
344 browser->window()->Show(); 347 browser->window()->Show();
345 WebContents* web_contents = 348 WebContents* web_contents =
346 browser->tab_strip_model()->GetActiveWebContents(); 349 browser->tab_strip_model()->GetActiveWebContents();
347 web_contents->GetDelegate()->ActivateContents(web_contents); 350 web_contents->GetDelegate()->ActivateContents(web_contents);
348 } 351 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698