summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 18:23:05 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 18:23:05 +0000
commite805baf32a66a7e73a9d3cb1512683c29af244b4 (patch)
treebc75cbc1b998b56545e32c44a4b118db8b6a7e50 /chrome/common
parent3243501e8b51236df8e9b010c84d7a093eabe7ad (diff)
downloadchromium_src-e805baf32a66a7e73a9d3cb1512683c29af244b4.zip
chromium_src-e805baf32a66a7e73a9d3cb1512683c29af244b4.tar.gz
chromium_src-e805baf32a66a7e73a9d3cb1512683c29af244b4.tar.bz2
Add ability to create extension/app for a bookmark-app drop.
R=estade@chromium.org BUG=none TEST=WebAppInfo.Bookmark,ExtensionTest.ExtraFlags,ExtensionPrefsFlags Review URL: http://codereview.chromium.org/7410004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/extension.h5
-rw-r--r--chrome/common/extensions/extension_unittest.cc13
-rw-r--r--chrome/common/web_apps.cc1
-rw-r--r--chrome/common/web_apps.h9
4 files changed, 27 insertions, 1 deletions
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 56bd95a..a2ee0e7 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -179,6 +179,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// |FROM_WEBSTORE| indicates that the extension was installed from the
// Chrome Web Store.
FROM_WEBSTORE = 1 << 3,
+
+ // |FROM_BOOKMARK| indicates the extension was created using a mock App
+ // created from a bookmark.
+ FROM_BOOKMARK = 1 << 4,
};
static scoped_refptr<Extension> Create(const FilePath& path,
@@ -509,6 +513,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
bool wants_file_access() const { return wants_file_access_; }
int creation_flags() const { return creation_flags_; }
bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; }
+ bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; }
const std::string& content_security_policy() const {
return content_security_policy_;
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index 9ad2a60..79cad1a 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -635,6 +635,19 @@ TEST(ExtensionTest, WantsFileAccess) {
file_url, &extension->content_scripts()[0], NULL));
}
+TEST(ExtensionTest, ExtraFlags) {
+ scoped_refptr<Extension> extension;
+ extension = LoadManifest("app", "manifest.json", Extension::FROM_WEBSTORE);
+ EXPECT_TRUE(extension->from_webstore());
+
+ extension = LoadManifest("app", "manifest.json", Extension::FROM_BOOKMARK);
+ EXPECT_TRUE(extension->from_bookmark());
+
+ extension = LoadManifest("app", "manifest.json", Extension::NO_FLAGS);
+ EXPECT_FALSE(extension->from_bookmark());
+ EXPECT_FALSE(extension->from_webstore());
+}
+
// Base class for testing the CanExecuteScriptOnPage and CanCaptureVisiblePage
// methods of Extension for extensions with various permissions.
class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
diff --git a/chrome/common/web_apps.cc b/chrome/common/web_apps.cc
index f586fe6..b6591b7 100644
--- a/chrome/common/web_apps.cc
+++ b/chrome/common/web_apps.cc
@@ -101,6 +101,7 @@ const char WebApplicationInfo::kInvalidIconURL[] =
"an absolute URL with the same origin as the application definition.";
WebApplicationInfo::WebApplicationInfo() {
+ is_bookmark_app = false;
}
WebApplicationInfo::~WebApplicationInfo() {
diff --git a/chrome/common/web_apps.h b/chrome/common/web_apps.h
index 4bc5d0a..2d8d01e 100644
--- a/chrome/common/web_apps.h
+++ b/chrome/common/web_apps.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -46,6 +46,13 @@ struct WebApplicationInfo {
// ID of the application.
GURL manifest_url;
+ // Setting indicating this application is artificially constructed. If set,
+ // the application was created from bookmark-style data (title, url, possibly
+ // icon), and not from an official manifest file. In that case, the app_url
+ // can be checked for the later creation of an official manifest instead of
+ // reloading the manifest_url.
+ bool is_bookmark_app;
+
// Title of the application.
string16 title;