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

Unified Diff: chrome/common/extensions/app_launcher_info.h

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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/common/extensions/app_launcher_info.h
diff --git a/chrome/common/extensions/app_launcher_info.h b/chrome/common/extensions/app_launcher_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ecd9f9318743b207518d6331f636fc2f00f3b73
--- /dev/null
+++ b/chrome/common/extensions/app_launcher_info.h
@@ -0,0 +1,78 @@
+// Copyright (c) 2013 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.
+
+#ifndef CHROME_COMMON_EXTENSIONS_APP_LAUNCHER_INFO_H_
Devlin 2013/04/16 21:40:58 Lately, these have been going into the chrome/comm
+#define CHROME_COMMON_EXTENSIONS_APP_LAUNCHER_INFO_H_
+
+#include <string>
+#include <vector>
+
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/extensions/manifest.h"
+#include "chrome/common/extensions/manifest_handler.h"
+#include "googleurl/src/gurl.h"
+
+namespace extensions {
+
+// Container that holds the parsed app launch data.
+class AppLauncherInfo : public Extension::ManifestData {
Yoyo Zhou 2013/04/16 23:18:24 This should be AppLaunchInfo.
+ public:
+ AppLauncherInfo();
+ virtual ~AppLauncherInfo();
+
+ static const std::string& GetLaunchLocalPath(const Extension* extension);
+ static const std::string& GetLaunchWebURL(const Extension* extension);
+ static extension_misc::LaunchContainer GetLaunchContainer(
+ const Extension* extension);
+ static int GetLaunchWidth(const Extension* extension);
+ static int GetLaunchHeight(const Extension* extension);
+ static GURL GetFullLaunchURL(const Extension* extension);
Devlin 2013/04/16 21:40:58 Why not const GURL&?
+
+ bool Parse(Extension* extension, string16* error);
+
+ private:
+ bool LoadLaunchURL(Extension* extension, string16* error);
+ bool LoadLaunchContainer(Extension* extension, string16* error);
+ void OverrideLaunchURL(Extension* extension, GURL override_url);
+
+ // The local path inside the extension to use with the launcher.
+ std::string launch_local_path_;
+
+ // An absolute web url to use with the launcher.
+ std::string launch_web_url_;
+
+ // The window type that an app's manifest specifies to launch into.
+ // This is not always the window type an app will open into, because
+ // users can override the way each app launches. See
+ // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
+ // to decide what container an app will launch in.
+ extension_misc::LaunchContainer launch_container_;
+
+ // The default size of the container when launching. Only respected for
+ // containers like panels and windows.
+ int launch_width_;
+ int launch_height_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppLauncherInfo);
+};
+
+// Parses all app launch related keys in the manifest.
+class AppLaunchManifestHandler : public ManifestHandler {
+ public:
+ AppLaunchManifestHandler();
+ virtual ~AppLaunchManifestHandler();
+
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
+ virtual bool AlwaysParseForType(Manifest::Type type) OVERRIDE;
+
+ private:
+ virtual const std::vector<std::string> Keys() const OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(AppLaunchManifestHandler);
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_APP_LAUNCHER_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698