Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 9 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 10 #include "third_party/WebKit/public/web/WebFrame.h" | 10 #include "third_party/WebKit/public/web/WebFrame.h" |
| 11 | 11 |
| 12 namespace content { | |
| 13 class RenderView; | |
| 14 } | |
| 15 | |
| 12 namespace extensions { | 16 namespace extensions { |
| 13 class ChromeV8Context; | 17 class ChromeV8Context; |
| 14 | 18 |
| 15 // A V8 extension that creates an object at window.chrome.webstore. This object | 19 // A V8 extension that creates an object at window.chrome.webstore. This object |
| 16 // allows JavaScript to initiate inline installs of apps that are listed in the | 20 // allows JavaScript to initiate inline installs of apps that are listed in the |
| 17 // Chrome Web Store (CWS). | 21 // Chrome Web Store (CWS). |
| 18 class WebstoreBindings : public ChromeV8Extension, | 22 class WebstoreBindings : public ChromeV8Extension, |
| 19 public ChromeV8ExtensionHandler { | 23 public ChromeV8ExtensionHandler { |
| 20 public: | 24 public: |
| 21 explicit WebstoreBindings(Dispatcher* dispatcher, | 25 explicit WebstoreBindings(Dispatcher* dispatcher, |
| 22 ChromeV8Context* context); | 26 ChromeV8Context* context); |
| 23 | 27 |
| 24 // IPC::Listener | 28 // IPC::Listener |
| 25 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 26 | 30 |
| 27 private: | 31 private: |
| 32 // Returns the RenderView from the WebFrame, or NULL on failure. | |
| 33 content::RenderView* GetRenderView(); | |
|
not at google - send to devlin
2014/02/27 21:49:56
this method already exists on ChromeV8Extension
Devlin
2014/02/28 18:04:51
Oh. Whoops. Done.
| |
| 34 | |
| 28 void Install(const v8::FunctionCallbackInfo<v8::Value>& args); | 35 void Install(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 29 | 36 |
| 30 void OnInlineWebstoreInstallResponse( | 37 void OnInlineWebstoreInstallResponse( |
| 31 int install_id, bool success, const std::string& error); | 38 int install_id, bool success, const std::string& error); |
| 32 | 39 |
| 40 void OnInlineInstallStageChanged(const std::string& stage); | |
| 41 | |
| 42 void OnInlineInstallDownloadProgress(int percent_downloaded); | |
| 43 | |
| 44 void ValidateInstallStageListener( | |
| 45 const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 46 | |
| 47 void ValidateDownloadProgressListener( | |
| 48 const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 49 | |
| 33 // Extracts a Web Store item ID from a <link rel="chrome-webstore-item" | 50 // Extracts a Web Store item ID from a <link rel="chrome-webstore-item" |
| 34 // href="https://chrome.google.com/webstore/detail/id"> node found in the | 51 // href="https://chrome.google.com/webstore/detail/id"> node found in the |
| 35 // frame. On success, true will be returned and the |webstore_item_id| | 52 // frame. On success, true will be returned and the |webstore_item_id| |
| 36 // parameter will be populated with the ID. On failure, false will be returned | 53 // parameter will be populated with the ID. On failure, false will be returned |
| 37 // and |error| will be populated with the error. | 54 // and |error| will be populated with the error. |
| 38 static bool GetWebstoreItemIdFromFrame( | 55 static bool GetWebstoreItemIdFromFrame( |
| 39 blink::WebFrame* frame, const std::string& preferred_store_link_url, | 56 blink::WebFrame* frame, const std::string& preferred_store_link_url, |
| 40 std::string* webstore_item_id, std::string* error); | 57 std::string* webstore_item_id, std::string* error); |
| 41 | 58 |
| 42 DISALLOW_COPY_AND_ASSIGN(WebstoreBindings); | 59 DISALLOW_COPY_AND_ASSIGN(WebstoreBindings); |
| 43 }; | 60 }; |
| 44 | 61 |
| 45 } // namespace extensions | 62 } // namespace extensions |
| 46 | 63 |
| 47 #endif // CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ | 64 #endif // CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ |
| OLD | NEW |