summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/extension.cc4
-rw-r--r--chrome/common/extensions/extension.h1
-rw-r--r--chrome/common/extensions/user_script.cc15
-rw-r--r--chrome/common/extensions/user_script.h8
-rw-r--r--chrome/common/render_messages_internal.h5
5 files changed, 17 insertions, 16 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index eef996e..c5e733b 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -117,12 +117,14 @@ const char* Extension::kTabPermission = "tabs";
const char* Extension::kBookmarkPermission = "bookmarks";
const char* Extension::kNotificationPermission = "notifications";
const char* Extension::kExperimentalPermission = "experimental";
+const char* Extension::kIncognitoPermission = "incognito";
const char* Extension::kPermissionNames[] = {
Extension::kTabPermission,
Extension::kBookmarkPermission,
Extension::kNotificationPermission,
- Extension::kExperimentalPermission
+ Extension::kExperimentalPermission,
+ Extension::kIncognitoPermission
};
const size_t Extension::kNumPermissions =
arraysize(Extension::kPermissionNames);
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 25093ff..1445943 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -79,6 +79,7 @@ class Extension {
static const char* kBookmarkPermission;
static const char* kNotificationPermission;
static const char* kExperimentalPermission;
+ static const char* kIncognitoPermission;
static const char* kPermissionNames[];
static const size_t kNumPermissions;
diff --git a/chrome/common/extensions/user_script.cc b/chrome/common/extensions/user_script.cc
index 7a48c14..5ed2040 100644
--- a/chrome/common/extensions/user_script.cc
+++ b/chrome/common/extensions/user_script.cc
@@ -75,17 +75,12 @@ void UserScript::File::Unpickle(const ::Pickle& pickle, void** iter) {
}
void UserScript::Pickle(::Pickle* pickle) const {
- // Write the run location.
+ // Write simple types.
pickle->WriteInt(run_location());
-
- // Write the extension id.
pickle->WriteString(extension_id());
-
- // Write Greasemonkey emulation.
pickle->WriteBool(emulate_greasemonkey());
-
- // Write match all frames
pickle->WriteBool(match_all_frames());
+ pickle->WriteBool(is_incognito_enabled());
// Write globs.
std::vector<std::string>::const_iterator glob;
@@ -127,14 +122,10 @@ void UserScript::Unpickle(const ::Pickle& pickle, void** iter) {
CHECK(run_location >= 0 && run_location < RUN_LOCATION_LAST);
run_location_ = static_cast<RunLocation>(run_location);
- // Read the extension ID.
CHECK(pickle.ReadString(iter, &extension_id_));
-
- // Read Greasemonkey emulation.
CHECK(pickle.ReadBool(iter, &emulate_greasemonkey_));
-
- // Read match all frames
CHECK(pickle.ReadBool(iter, &match_all_frames_));
+ CHECK(pickle.ReadBool(iter, &incognito_enabled_));
// Read globs.
size_t num_globs = 0;
diff --git a/chrome/common/extensions/user_script.h b/chrome/common/extensions/user_script.h
index 9fbbe89..ed84009 100644
--- a/chrome/common/extensions/user_script.h
+++ b/chrome/common/extensions/user_script.h
@@ -102,7 +102,7 @@ class UserScript {
// Greasemonkey and probably more useful for typical scripts.
UserScript()
: run_location_(DOCUMENT_IDLE), emulate_greasemonkey_(false),
- match_all_frames_(false) {
+ match_all_frames_(false), incognito_enabled_(false) {
}
const std::string& name_space() const { return name_space_; }
@@ -162,6 +162,9 @@ class UserScript {
const std::string& extension_id() const { return extension_id_; }
void set_extension_id(const std::string& id) { extension_id_ = id; }
+ bool is_incognito_enabled() const { return incognito_enabled_; }
+ void set_incognito_enabled(bool enabled) { incognito_enabled_ = enabled; }
+
bool is_standalone() const { return extension_id_.empty(); }
// Returns true if the script should be applied to the specified URL, false
@@ -217,6 +220,9 @@ class UserScript {
// Whether the user script should run in all frames, or only just the top one.
// Defaults to false.
bool match_all_frames_;
+
+ // True if the script should be injected into an incognito tab.
+ bool incognito_enabled_;
};
typedef std::vector<UserScript> UserScriptList;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 3a58772..a37ba09 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -239,8 +239,9 @@ IPC_BEGIN_MESSAGES(View)
// Notification that the user scripts have been updated. It has one
// SharedMemoryHandle argument consisting of the pickled script data. This
// handle is valid in the context of the renderer.
- IPC_MESSAGE_CONTROL1(ViewMsg_UserScripts_UpdatedScripts,
- base::SharedMemoryHandle)
+ IPC_MESSAGE_CONTROL2(ViewMsg_UserScripts_UpdatedScripts,
+ base::SharedMemoryHandle,
+ bool /* only_inject_incognito */)
// Sent when the user wants to search for a word on the page (find in page).
IPC_MESSAGE_ROUTED3(ViewMsg_Find,