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

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: more cleanups 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 944de1c7382c2a8f044a405083464ac82cf22337..037ec3399718faf6ed42b6babea493bfafe8b15c 100644
--- a/chrome/browser/extensions/extension_tabs_module.h
+++ b/chrome/browser/extensions/extension_tabs_module.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,12 +17,41 @@
#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.
+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() {}
@@ -109,8 +138,12 @@ class UpdateTabFunction : public AsyncExtensionFunction,
public content::WebContentsObserver {
public:
UpdateTabFunction();
- private:
+ protected:
virtual ~UpdateTabFunction() {}
+ virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props,
+ content::WebContents* web_contents,
+ bool* is_async);
+ private:
virtual bool RunImpl() OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
void OnExecuteCodeFinished(int request_id,
@@ -148,7 +181,7 @@ class DetectTabLanguageFunction : public AsyncExtensionFunction,
};
class CaptureVisibleTabFunction : public AsyncExtensionFunction,
public content::NotificationObserver {
- private:
+ protected:
enum ImageFormat {
FORMAT_JPEG,
FORMAT_PNG
@@ -159,6 +192,8 @@ class CaptureVisibleTabFunction : public AsyncExtensionFunction,
virtual ~CaptureVisibleTabFunction() {}
virtual bool RunImpl() OVERRIDE;
+ virtual bool GetTabToCapture(content::WebContents** web_contents,
+ TabContentsWrapper** wrapper);
virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
virtual void Observe(int type,
const content::NotificationSource& source,

Powered by Google App Engine
This is Rietveld 408576698