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

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

Issue 2434063002: Move extensions code from WebContents::GetURL to GetLastCommittedURL.
Patch Set: Refactor to simplify. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_util.h
diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h
index fe47b014c11a4ce3153396aaf483e1ce962c0f0b..ba27c83bbc6a796f091aae14d87675a2c10f0f4f 100644
--- a/chrome/browser/extensions/extension_tab_util.h
+++ b/chrome/browser/extensions/extension_tab_util.h
@@ -84,6 +84,8 @@ class ExtensionTabUtil {
int window_id,
std::string* error_message);
+ enum UrlType { LastCommitted, Visible };
nasko 2016/10/20 00:48:42 This along with the methods taking it can potentia
Devlin 2016/10/20 17:27:24 I'm fine with it here (and think it should be; see
+
// Creates a Tab object (see chrome/common/extensions/api/tabs.json) with
// information about the state of a browser tab. Depending on the
// permissions of the extension, the object may or may not include sensitive
@@ -91,24 +93,48 @@ class ExtensionTabUtil {
static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
const Extension* extension) {
- return CreateTabObject(web_contents, nullptr, -1, extension);
+ return CreateTabObject(web_contents, nullptr, -1, extension,
+ UrlType::LastCommitted);
}
static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
TabStripModel* tab_strip,
int tab_index,
- const Extension* extension);
+ const Extension* extension) {
+ return CreateTabObject(web_contents, nullptr, -1, extension,
+ UrlType::LastCommitted);
+ }
+ static std::unique_ptr<api::tabs::Tab> CreateTabObjectVisibleUrl(
Devlin 2016/10/20 17:27:24 In the tabs API, we'll also scrub the tab object o
+ content::WebContents* web_contents,
+ const Extension* extension) {
+ return CreateTabObject(web_contents, nullptr, -1, extension,
+ UrlType::Visible);
+ }
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
+ content::WebContents* web_contents,
+ TabStripModel* tab_strip,
+ int tab_index,
+ const Extension* extension,
+ UrlType url_type);
// Creates a Tab object but performs no extension permissions checks; the
// returned object will contain privacy-sensitive data.
static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents) {
- return CreateTabObject(web_contents, nullptr, -1);
+ return CreateTabObject(web_contents, nullptr, -1, UrlType::LastCommitted);
+ }
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
+ content::WebContents* web_contents,
+ TabStripModel* tab_strip,
+ int tab_index) {
+ return CreateTabObject(web_contents, tab_strip, tab_index,
+ UrlType::LastCommitted);
}
static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
TabStripModel* tab_strip,
- int tab_index);
+ int tab_index,
+ UrlType url_type);
// Creates a tab MutedInfo object (see chrome/common/extensions/api/tabs.json)
// with information about the mute state of a browser tab.
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698