summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_tab_util.cc
diff options
context:
space:
mode:
authorjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 19:56:35 +0000
committerjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 19:56:35 +0000
commit45c75e6513af5c124c0c8d7ed866227a6c848e98 (patch)
treee679d0b79ffdb01523d8a934fa762f72d621418b /chrome/browser/extensions/extension_tab_util.cc
parentd7bc74ab00e36f4770425091be99b04fcf923b54 (diff)
downloadchromium_src-45c75e6513af5c124c0c8d7ed866227a6c848e98.zip
chromium_src-45c75e6513af5c124c0c8d7ed866227a6c848e98.tar.gz
chromium_src-45c75e6513af5c124c0c8d7ed866227a6c848e98.tar.bz2
Re-land alexbost's experimental offscreenTabs API.
Original code review: http://codereview.chromium.org/7720002/ A followup code review: http://chromiumcodereview.appspot.com/9150052/ This includes some refactoring to simplify and reduce the code size: - sharing more code between tabs and offscreenTabs - splitting up and fixing the browser tests - forbidding use of the API from a background page BUG=110833 TEST=OffscreenTabsApiTest.* Review URL: https://chromiumcodereview.appspot.com/9813014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tab_util.cc')
-rw-r--r--chrome/browser/extensions/extension_tab_util.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 98bd098..9f91a3a 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -12,9 +12,13 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
+#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
+#include "googleurl/src/gurl.h"
namespace keys = extension_tabs_module_constants;
namespace errors = extension_manifest_errors;
@@ -223,3 +227,21 @@ bool ExtensionTabUtil::GetTabById(int tab_id,
}
return false;
}
+
+GURL ExtensionTabUtil::ResolvePossiblyRelativeURL(const std::string& url_string,
+ const Extension* extension) {
+ GURL url = GURL(url_string);
+ if (!url.is_valid())
+ url = extension->GetResourceURL(url_string);
+
+ return url;
+}
+
+bool ExtensionTabUtil::IsCrashURL(const GURL& url) {
+ // Check a fixed-up URL, to normalize the scheme and parse hosts correctly.
+ GURL fixed_url =
+ URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string());
+ return (fixed_url.SchemeIs(chrome::kChromeUIScheme) &&
+ (fixed_url.host() == chrome::kChromeUIBrowserCrashHost ||
+ fixed_url.host() == chrome::kChromeUICrashHost));
+}