| 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_API_TABS_TABS_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_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 "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 class BackingStore; | 18 class BackingStore; |
| 19 class GURL; | 19 class GURL; |
| 20 class SkBitmap; | 20 class SkBitmap; |
| 21 class TabContents; | 21 class TabContents; |
| 22 typedef TabContents TabContentsWrapper; | |
| 23 | 22 |
| 24 namespace base { | 23 namespace base { |
| 25 class DictionaryValue; | 24 class DictionaryValue; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 class WebContents; | 28 class WebContents; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace skia { | 31 namespace skia { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 class UpdateTabFunction : public AsyncExtensionFunction { | 117 class UpdateTabFunction : public AsyncExtensionFunction { |
| 119 public: | 118 public: |
| 120 UpdateTabFunction(); | 119 UpdateTabFunction(); |
| 121 | 120 |
| 122 protected: | 121 protected: |
| 123 virtual ~UpdateTabFunction() {} | 122 virtual ~UpdateTabFunction() {} |
| 124 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props, | 123 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props, |
| 125 bool* is_async); | 124 bool* is_async); |
| 126 virtual void PopulateResult(); | 125 virtual void PopulateResult(); |
| 127 | 126 |
| 128 TabContentsWrapper* tab_contents_; | 127 TabContents* tab_contents_; |
| 129 | 128 |
| 130 private: | 129 private: |
| 131 virtual bool RunImpl() OVERRIDE; | 130 virtual bool RunImpl() OVERRIDE; |
| 132 void OnExecuteCodeFinished(bool success, | 131 void OnExecuteCodeFinished(bool success, |
| 133 int32 page_id, | 132 int32 page_id, |
| 134 const std::string& error); | 133 const std::string& error); |
| 135 | 134 |
| 136 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") | 135 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") |
| 137 }; | 136 }; |
| 138 class MoveTabsFunction : public SyncExtensionFunction { | 137 class MoveTabsFunction : public SyncExtensionFunction { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 FORMAT_JPEG, | 169 FORMAT_JPEG, |
| 171 FORMAT_PNG | 170 FORMAT_PNG |
| 172 }; | 171 }; |
| 173 | 172 |
| 174 // The default quality setting used when encoding jpegs. | 173 // The default quality setting used when encoding jpegs. |
| 175 static const int kDefaultQuality; | 174 static const int kDefaultQuality; |
| 176 | 175 |
| 177 virtual ~CaptureVisibleTabFunction() {} | 176 virtual ~CaptureVisibleTabFunction() {} |
| 178 virtual bool RunImpl() OVERRIDE; | 177 virtual bool RunImpl() OVERRIDE; |
| 179 virtual bool GetTabToCapture(content::WebContents** web_contents, | 178 virtual bool GetTabToCapture(content::WebContents** web_contents, |
| 180 TabContentsWrapper** wrapper); | 179 TabContents** tab_contents); |
| 181 virtual void Observe(int type, | 180 virtual void Observe(int type, |
| 182 const content::NotificationSource& source, | 181 const content::NotificationSource& source, |
| 183 const content::NotificationDetails& details) OVERRIDE; | 182 const content::NotificationDetails& details) OVERRIDE; |
| 184 void SendResultFromBitmap(const SkBitmap& screen_capture); | 183 void SendResultFromBitmap(const SkBitmap& screen_capture); |
| 185 | 184 |
| 186 private: | 185 private: |
| 187 void CopyFromBackingStoreComplete(skia::PlatformCanvas* canvas, | 186 void CopyFromBackingStoreComplete(skia::PlatformCanvas* canvas, |
| 188 bool succeeded); | 187 bool succeeded); |
| 189 | 188 |
| 190 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
| 191 | 190 |
| 192 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 191 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
| 193 ImageFormat image_format_; | 192 ImageFormat image_format_; |
| 194 | 193 |
| 195 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 194 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
| 196 int image_quality_; | 195 int image_quality_; |
| 197 | 196 |
| 198 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") | 197 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") |
| 199 }; | 198 }; |
| 200 | 199 |
| 201 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ | 200 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ |
| OLD | NEW |