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

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 164335: Add a method to classify what permission class an extension is in, with unit (Closed)
Patch Set: Created 11 years, 4 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 const std::vector<std::string>& icon_paths = it->second->icon_paths(); 946 const std::vector<std::string>& icon_paths = it->second->icon_paths();
947 for (std::vector<std::string>::const_iterator iter = icon_paths.begin(); 947 for (std::vector<std::string>::const_iterator iter = icon_paths.begin();
948 iter != icon_paths.end(); ++iter) { 948 iter != icon_paths.end(); ++iter) {
949 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter))); 949 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter)));
950 } 950 }
951 } 951 }
952 952
953 return image_paths; 953 return image_paths;
954 } 954 }
955 955
956 Extension::PermissionClass Extension::GetPermissionClass() {
957 // Native code can do anything. Highest class.
958 if (!plugins_.empty())
959 return PERMISSION_CLASS_FULL;
960
961 // Access to other sites means the extension can steal cookies (login data)
962 // from those sites.
963 // TODO(mpcomplete): should we only classify for host access outside the
964 // extension's origin? how?
965 if (!host_permissions_.empty() || !content_scripts_.empty())
966 return PERMISSION_CLASS_HIGH;
967
968 // Extension can access history data, bookmarks, other personal info.
969 if (!api_permissions_.empty())
970 return PERMISSION_CLASS_MEDIUM;
971
972 return PERMISSION_CLASS_LOW;
973 }
974
956 bool Extension::GetBackgroundPageReady() { 975 bool Extension::GetBackgroundPageReady() {
957 return background_page_ready_ || background_url().is_empty(); 976 return background_page_ready_ || background_url().is_empty();
958 } 977 }
959 978
960 void Extension::SetBackgroundPageReady() { 979 void Extension::SetBackgroundPageReady() {
961 DCHECK(!background_url().is_empty()); 980 DCHECK(!background_url().is_empty());
962 background_page_ready_ = true; 981 background_page_ready_ = true;
963 NotificationService::current()->Notify( 982 NotificationService::current()->Notify(
964 NotificationType::EXTENSION_BACKGROUND_PAGE_READY, 983 NotificationType::EXTENSION_BACKGROUND_PAGE_READY,
965 Source<Extension>(this), 984 Source<Extension>(this),
966 NotificationService::NoDetails()); 985 NotificationService::NoDetails());
967 } 986 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698