Chromium Code Reviews| Index: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| index 022c8c062164db002b0e1baecdc35cf538610f86..462323ee2d3c51fcaeff039730f790210227c068 100644 |
| --- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| +++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| @@ -28,6 +28,8 @@ namespace SetIcon = app_current_window_internal::SetIcon; |
| namespace SetBadgeIcon = app_current_window_internal::SetBadgeIcon; |
| namespace SetShape = app_current_window_internal::SetShape; |
| namespace SetAlwaysOnTop = app_current_window_internal::SetAlwaysOnTop; |
| +namespace SetInterceptAllKeys = |
| + app_current_window_internal::SetInterceptAllKeys; |
| using apps::AppWindow; |
| using app_current_window_internal::Bounds; |
| @@ -52,6 +54,11 @@ const char kRequiresFramelessWindow[] = |
| const char kAlwaysOnTopPermission[] = |
| "The \"app.window.alwaysOnTop\" permission is required."; |
| +const char kInterceptAllKeysPermission[] = "app.window.interceptAllKeys"; |
| + |
| +const char kInterceptAllKeysPermissionError[] = |
| + "The \"app.window.interceptAllKeys\" permission is required."; |
| + |
| const char kInvalidParameters[] = "Invalid parameters."; |
| const int kUnboundedSize = apps::SizeConstraints::kUnboundedSize; |
| @@ -399,4 +406,24 @@ bool AppCurrentWindowInternalSetAlwaysOnTopFunction::RunWithWindow( |
| return true; |
| } |
| +bool AppCurrentWindowInternalSetInterceptAllKeysFunction::RunWithWindow( |
| + AppWindow* window) { |
| + if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) { |
|
benwells
2014/07/16 09:39:14
Since the permission is only available in dev chan
Sriram
2014/07/24 22:38:54
Followed pattern used with other API cls and also
|
| + error_ = kDevChannelOnly; |
| + return false; |
| + } |
| + |
| + if (!GetExtension()->permissions_data()->HasAPIPermission( |
| + kInterceptAllKeysPermission)) { |
| + error_ = kInterceptAllKeysPermissionError; |
| + return false; |
| + } |
| + |
| + scoped_ptr<SetInterceptAllKeys::Params> params( |
| + SetInterceptAllKeys::Params::Create(*args_)); |
| + CHECK(params.get()); |
| + window->SetInterceptAllKeys(params->want_all_keys); |
| + return true; |
| +} |
| + |
| } // namespace extensions |