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

Unified Diff: chrome/browser/chromeos/extensions/input_method_event_router.cc

Issue 9317013: Add a centralized mechanism for whitelisting access to extension permissions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/input_method_event_router.cc
diff --git a/chrome/browser/chromeos/extensions/input_method_event_router.cc b/chrome/browser/chromeos/extensions/input_method_event_router.cc
index 18a06f66b29f7a441a564f6d5d5aab3923e3dc3e..9972db481c2e4ee6e8e1f6ea39c39e976f2e7800 100644
--- a/chrome/browser/chromeos/extensions/input_method_event_router.cc
+++ b/chrome/browser/chromeos/extensions/input_method_event_router.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include "base/json/json_writer.h"
-#include "base/lazy_instance.h"
#include "base/values.h"
#include "chrome/browser/chromeos/web_socket_proxy_controller.h"
#include "chrome/browser/extensions/extension_event_names.h"
@@ -20,30 +19,6 @@ namespace {
// Prefix, which is used by XKB.
const char kXkbPrefix[] = "xkb:";
-// Extension ID which is used in browser_tests.
-const char kInputMethodTestExtensionID[] = "ilanclmaeigfpnmdlgelmhkpkegdioip";
-
-class InputMethodPrivateExtensionsWhitelist {
- public:
- InputMethodPrivateExtensionsWhitelist() {
- chromeos::FillWithExtensionsIdsWithPrivateAccess(&ids_);
- ids_.push_back(kInputMethodTestExtensionID);
- std::sort(ids_.begin(), ids_.end());
- }
-
- bool HasId(const std::string& id) {
- return std::binary_search(ids_.begin(), ids_.end(), id);
- }
-
- const std::vector<std::string>& ids() { return ids_; }
-
- private:
- std::vector<std::string> ids_;
-};
-
-base::LazyInstance<InputMethodPrivateExtensionsWhitelist>
- g_input_method_private_extensions_whitelist = LAZY_INSTANCE_INITIALIZER;
-
} // namespace
namespace chromeos {
@@ -73,16 +48,10 @@ void ExtensionInputMethodEventRouter::InputMethodChanged(
std::string args_json;
base::JSONWriter::Write(&args, false, &args_json);
- const std::vector<std::string>& ids =
- g_input_method_private_extensions_whitelist.Get().ids();
-
- for (size_t i = 0; i < ids.size(); ++i) {
- // ExtensionEventRoutner will check that the extension is listening for the
- // event.
- router->DispatchEventToExtension(
- ids[i], extension_event_names::kOnInputMethodChanged,
- args_json, profile, GURL());
- }
+ // The router will only send the event to extensions that are listening.
+ router->DispatchEventToRenderers(
+ extension_event_names::kOnInputMethodChanged,
+ args_json, profile, GURL());
}
void ExtensionInputMethodEventRouter::ActiveInputMethodsChanged(
@@ -103,9 +72,4 @@ std::string ExtensionInputMethodEventRouter::GetInputMethodForXkb(
return xkb_id.substr(prefix_length);
}
-bool ExtensionInputMethodEventRouter::IsExtensionWhitelisted(
- const std::string& extension_id) {
- return g_input_method_private_extensions_whitelist.Get().HasId(extension_id);
-}
-
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/extensions/input_method_event_router.h ('k') | chrome/browser/chromeos/web_socket_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698