| 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_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/browser/extensions/extension_function.h" | 13 #include "chrome/browser/extensions/extension_function.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | |
| 17 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 18 | 17 |
| 19 class BackingStore; | 18 class BackingStore; |
| 20 class Extension; | 19 class Extension; |
| 21 class GURL; | 20 class GURL; |
| 22 class SkBitmap; | 21 class SkBitmap; |
| 23 class TabContentsWrapper; | 22 class TabContentsWrapper; |
| 24 namespace base { | 23 namespace base { |
| 25 class DictionaryValue; | 24 class DictionaryValue; |
| 26 } // namespace base | 25 } // namespace base |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 class CreateTabFunction : public SyncExtensionFunction { | 105 class CreateTabFunction : public SyncExtensionFunction { |
| 107 virtual ~CreateTabFunction() {} | 106 virtual ~CreateTabFunction() {} |
| 108 virtual bool RunImpl() OVERRIDE; | 107 virtual bool RunImpl() OVERRIDE; |
| 109 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") | 108 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") |
| 110 }; | 109 }; |
| 111 class HighlightTabsFunction : public SyncExtensionFunction { | 110 class HighlightTabsFunction : public SyncExtensionFunction { |
| 112 virtual ~HighlightTabsFunction() {} | 111 virtual ~HighlightTabsFunction() {} |
| 113 virtual bool RunImpl() OVERRIDE; | 112 virtual bool RunImpl() OVERRIDE; |
| 114 DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight") | 113 DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight") |
| 115 }; | 114 }; |
| 116 class UpdateTabFunction : public AsyncExtensionFunction, | 115 class UpdateTabFunction : public AsyncExtensionFunction { |
| 117 public content::WebContentsObserver { | |
| 118 public: | 116 public: |
| 119 UpdateTabFunction(); | 117 UpdateTabFunction(); |
| 120 | 118 |
| 121 protected: | 119 protected: |
| 122 virtual ~UpdateTabFunction() {} | 120 virtual ~UpdateTabFunction() {} |
| 123 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props, | 121 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props, |
| 124 bool* is_async); | 122 bool* is_async); |
| 125 virtual void PopulateResult(); | 123 virtual void PopulateResult(); |
| 126 | 124 |
| 127 content::WebContents* web_contents_; | 125 TabContentsWrapper* tab_contents_; |
| 128 | 126 |
| 129 private: | 127 private: |
| 130 virtual bool RunImpl() OVERRIDE; | 128 virtual bool RunImpl() OVERRIDE; |
| 131 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; | 129 void OnExecuteCodeFinished(bool success, const std::string& error); |
| 132 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 133 void OnExecuteCodeFinished(int request_id, | |
| 134 bool success, | |
| 135 const std::string& error); | |
| 136 | 130 |
| 137 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") | 131 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") |
| 138 }; | 132 }; |
| 139 class MoveTabsFunction : public SyncExtensionFunction { | 133 class MoveTabsFunction : public SyncExtensionFunction { |
| 140 virtual ~MoveTabsFunction() {} | 134 virtual ~MoveTabsFunction() {} |
| 141 virtual bool RunImpl() OVERRIDE; | 135 virtual bool RunImpl() OVERRIDE; |
| 142 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") | 136 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") |
| 143 }; | 137 }; |
| 144 class ReloadTabFunction : public SyncExtensionFunction { | 138 class ReloadTabFunction : public SyncExtensionFunction { |
| 145 virtual ~ReloadTabFunction() {} | 139 virtual ~ReloadTabFunction() {} |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 187 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
| 194 ImageFormat image_format_; | 188 ImageFormat image_format_; |
| 195 | 189 |
| 196 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 190 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
| 197 int image_quality_; | 191 int image_quality_; |
| 198 | 192 |
| 199 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 193 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
| 200 }; | 194 }; |
| 201 | 195 |
| 202 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ | 196 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ |
| OLD | NEW |