| 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/common/extensions/webstore_install_result.h" | 9 #include "chrome/common/extensions/webstore_install_result.h" |
| 10 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h" | 10 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h" |
| 11 #include "extensions/renderer/object_backed_native_handler.h" | 11 #include "extensions/renderer/object_backed_native_handler.h" |
| 12 | 12 #include "third_party/WebKit/public/web/WebFrame.h" |
| 13 namespace blink { | |
| 14 class WebLocalFrame; | |
| 15 } | |
| 16 | 13 |
| 17 namespace extensions { | 14 namespace extensions { |
| 18 | 15 |
| 19 // A V8 extension that creates an object at window.chrome.webstore. This object | 16 // A V8 extension that creates an object at window.chrome.webstore. This object |
| 20 // allows JavaScript to initiate inline installs of apps that are listed in the | 17 // allows JavaScript to initiate inline installs of apps that are listed in the |
| 21 // Chrome Web Store (CWS). | 18 // Chrome Web Store (CWS). |
| 22 class WebstoreBindings : public ObjectBackedNativeHandler, | 19 class WebstoreBindings : public ObjectBackedNativeHandler, |
| 23 public ChromeV8ExtensionHandler { | 20 public ChromeV8ExtensionHandler { |
| 24 public: | 21 public: |
| 25 explicit WebstoreBindings(ScriptContext* context); | 22 explicit WebstoreBindings(ScriptContext* context); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 void OnInlineInstallStageChanged(int stage); | 35 void OnInlineInstallStageChanged(int stage); |
| 39 | 36 |
| 40 void OnInlineInstallDownloadProgress(int percent_downloaded); | 37 void OnInlineInstallDownloadProgress(int percent_downloaded); |
| 41 | 38 |
| 42 // Extracts a Web Store item ID from a <link rel="chrome-webstore-item" | 39 // Extracts a Web Store item ID from a <link rel="chrome-webstore-item" |
| 43 // href="https://chrome.google.com/webstore/detail/id"> node found in the | 40 // href="https://chrome.google.com/webstore/detail/id"> node found in the |
| 44 // frame. On success, true will be returned and the |webstore_item_id| | 41 // frame. On success, true will be returned and the |webstore_item_id| |
| 45 // parameter will be populated with the ID. On failure, false will be returned | 42 // parameter will be populated with the ID. On failure, false will be returned |
| 46 // and |error| will be populated with the error. | 43 // and |error| will be populated with the error. |
| 47 static bool GetWebstoreItemIdFromFrame( | 44 static bool GetWebstoreItemIdFromFrame( |
| 48 blink::WebLocalFrame* frame, | 45 blink::WebFrame* frame, const std::string& preferred_store_link_url, |
| 49 const std::string& preferred_store_link_url, | 46 std::string* webstore_item_id, std::string* error); |
| 50 std::string* webstore_item_id, | |
| 51 std::string* error); | |
| 52 | 47 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebstoreBindings); | 48 DISALLOW_COPY_AND_ASSIGN(WebstoreBindings); |
| 54 }; | 49 }; |
| 55 | 50 |
| 56 } // namespace extensions | 51 } // namespace extensions |
| 57 | 52 |
| 58 #endif // CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ | 53 #endif // CHROME_RENDERER_EXTENSIONS_WEBSTORE_BINDINGS_H_ |
| OLD | NEW |