Fix vectorized icon for PPAPI broker website setting icon
[chromium-blink-merge.git] / chrome / renderer / extensions / app_bindings.h
blobd85396eecc7e4ef4a6371512f29a8d0023e28cb7
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
3 // found in the LICENSE file.
5 // The AppObjectExtension is a v8 extension that creates an object
6 // at window.chrome.app. This object allows javascript to get details
7 // on the app state of the page.
8 // The read-only property app.isInstalled is true if the current page is
9 // within the extent of an installed, enabled app.
11 #ifndef CHROME_RENDERER_EXTENSIONS_APP_BINDINGS_H_
12 #define CHROME_RENDERER_EXTENSIONS_APP_BINDINGS_H_
14 #include "base/compiler_specific.h"
15 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h"
16 #include "extensions/renderer/object_backed_native_handler.h"
17 #include "third_party/WebKit/public/web/WebFrame.h"
19 namespace extensions {
20 class Dispatcher;
22 // Implements the chrome.app JavaScript object.
24 // TODO(aa): Add unit testing for this class.
25 class AppBindings : public ObjectBackedNativeHandler,
26 public ChromeV8ExtensionHandler {
27 public:
28 AppBindings(Dispatcher* dispatcher, ScriptContext* context);
29 ~AppBindings() override;
31 private:
32 // IPC::Listener
33 bool OnMessageReceived(const IPC::Message& message) override;
35 void GetIsInstalled(const v8::FunctionCallbackInfo<v8::Value>& args);
36 void GetDetails(const v8::FunctionCallbackInfo<v8::Value>& args);
37 void GetInstallState(const v8::FunctionCallbackInfo<v8::Value>& args);
38 void GetRunningState(const v8::FunctionCallbackInfo<v8::Value>& args);
40 v8::Local<v8::Value> GetDetailsImpl(blink::WebLocalFrame* frame);
42 void OnAppInstallStateResponse(const std::string& state, int callback_id);
44 // Dispatcher handle. Not owned.
45 Dispatcher* dispatcher_;
47 DISALLOW_COPY_AND_ASSIGN(AppBindings);
50 } // namespace extensions
52 #endif // CHROME_RENDERER_EXTENSIONS_APP_BINDINGS_H_