Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2021)

Unified Diff: chrome/browser/extensions/extension_tabs_module.h

Issue 9234042: Re-land alexbost's experimental offscreenTabs API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: merge / rebase Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_tabs_module.h
diff --git a/chrome/browser/extensions/extension_tabs_module.h b/chrome/browser/extensions/extension_tabs_module.h
index 61f2c398fd2419e7ec7428ad662aa44e83be7a09..60dc1f2e313c2d5de6bfa99a0c6c8affbcb240fc 100644
--- a/chrome/browser/extensions/extension_tabs_module.h
+++ b/chrome/browser/extensions/extension_tabs_module.h
@@ -17,13 +17,39 @@
#include "googleurl/src/gurl.h"
class BackingStore;
+class Extension;
+class GURL;
class SkBitmap;
+class TabContentsWrapper;
namespace base {
class DictionaryValue;
} // namespace base
namespace content {
class WebContents;
} // namespace content
+
+
+// TODO(jstritar): These helper methods are exposed so the offscreen tabs API
+// can use them. We should remove these once the APIs are combined.
asargent_no_longer_on_chrome 2012/02/29 18:20:52 Would it be appropriate for these to go in extensi
jstritar 2012/03/12 14:53:06 Yeah, they can probably go there.
+namespace extensions {
+namespace tabs_module {
+
+// Takes |url_string| and returns a GURL which is either valid and absolute
+// or invalid. If |url_string| is not directly interpretable as a valid (it is
+// likely a relative URL) an attempt is made to resolve it. |extension| is
+// provided so it can be resolved relative to its extension base
+// (chrome-extension://<id>/). Using the source frame url would be more correct,
+// but because the api shipped with urls resolved relative to their extension
+// base, we decided it wasn't worth breaking existing extensions to fix.
+GURL ResolvePossiblyRelativeURL(const std::string& url_string,
+ const Extension* extension);
+
+// Returns true if |url| is used for testing crashes.
+bool IsCrashURL(const GURL& url);
+
+} // namespace tabs_module
+} // namespace extensions
+
// Windows
class GetWindowFunction : public SyncExtensionFunction {
virtual ~GetWindowFunction() {}
@@ -110,17 +136,23 @@ class UpdateTabFunction : public AsyncExtensionFunction,
public content::WebContentsObserver {
public:
UpdateTabFunction();
- private:
+
+ protected:
virtual ~UpdateTabFunction() {}
+ virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props,
+ bool* is_async);
+ void PopulateResult();
+
+ content::WebContents* web_contents_;
+
+ private:
virtual bool RunImpl() OVERRIDE;
virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
void OnExecuteCodeFinished(int request_id,
bool success,
const std::string& error);
- void PopulateResult();
- content::WebContents* web_contents_;
DECLARE_EXTENSION_FUNCTION_NAME("tabs.update")
};
class MoveTabsFunction : public SyncExtensionFunction {
@@ -153,7 +185,7 @@ class DetectTabLanguageFunction : public AsyncExtensionFunction,
};
class CaptureVisibleTabFunction : public AsyncExtensionFunction,
public content::NotificationObserver {
- private:
+ protected:
enum ImageFormat {
FORMAT_JPEG,
FORMAT_PNG
@@ -164,7 +196,10 @@ class CaptureVisibleTabFunction : public AsyncExtensionFunction,
virtual ~CaptureVisibleTabFunction() {}
virtual bool RunImpl() OVERRIDE;
- virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
+ virtual bool GetTabToCapture(content::WebContents** web_contents,
+ TabContentsWrapper** wrapper);
+ virtual bool CaptureSnapshotFromBackingStore(
+ content::WebContents* backing_store);
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698