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

Unified Diff: chrome/browser/extensions/api/developer_private/developer_private_api.h

Issue 11428116: First few API implementation of AppsDebuggerPrivate. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding test files Created 8 years 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/browser/extensions/api/developer_private/developer_private_api.h
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..502c1994e4229fe94ed4282e78fb67e00e0c1641
--- /dev/null
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -0,0 +1,123 @@
+// Copyright (c) 2012 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_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_
+
+#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/extension_install_prompt.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/render_view_host.h"
+
+namespace extensions {
miket_OOO 2012/12/06 19:31:15 Vertical whitespace inside each namespace open/clo
Gaurav 2012/12/12 02:23:38 Done.
+namespace api {
+namespace developer_private {
+struct ItemInfo;
+struct ItemInspectView;
+}
miket_OOO 2012/12/06 19:31:15 These normally get commented with // namespace nam
Gaurav 2012/12/12 02:23:38 Done.
+}
+class ExtensionSystem;
+}
+
+namespace developer = extensions::api::developer_private;
+
+typedef std::vector<linked_ptr<developer::ItemInfo> > ItemInfoList;
+typedef std::vector<linked_ptr<developer::ItemInspectView> >
+ ItemInspectViewList;
+
+namespace extensions {
+
+// The profile-keyed service that manages the DeveloperPrivate API.
+class DeveloperPrivateAPI : public ProfileKeyedService,
+ public content::NotificationObserver {
+ public:
+ // Convenience method to get the DeveloperPrivateAPI for a profile.
+ static DeveloperPrivateAPI* Get(Profile* profile);
+
+ explicit DeveloperPrivateAPI(Profile* profile);
+ virtual ~DeveloperPrivateAPI();
+
+ void AddItemsInfo(const ExtensionSet& items,
+ ExtensionSystem* system,
+ ItemInfoList* item_list);
+
+ // ProfileKeyedService implementation
+ virtual void Shutdown() OVERRIDE;
+
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ private:
+
miket_OOO 2012/12/06 19:31:15 Be consistent about vertical whitespace after acce
Gaurav 2012/12/12 02:23:38 Done.
+ void RegisterNotifications();
+
+ scoped_ptr<developer::ItemInfo> CreateItemInfo(
+ const extensions::Extension& item,
+ ExtensionSystem* system,
+ bool item_is_enabled);
+
+ // Helper that lists the current inspectable html pages for the extension.
+ void GetInspectablePagesForExtensionProcess(
+ const std::set<content::RenderViewHost*>& views,
+ ItemInspectViewList* result);
+
+ ItemInspectViewList GetInspectablePagesForExtension(
+ const extensions::Extension* extension,
+ bool extension_is_enabled);
+
+ Profile* profile_;
+
+ content::NotificationRegistrar registrar_;
+
+ // The page may be refreshed in response to a RENDER_VIEW_HOST_DELETED,
+ // but the iteration over RenderViewHosts will include the host because the
+ // notification is sent when it is in the process of being deleted (and before
+ // it is removed from the process). Keep a pointer to it so we can exclude
+ // it from the active views.
+ content::RenderViewHost* deleting_rvh_;
miket_OOO 2012/12/06 19:31:15 Avoid abbreviations if possible/practical.
Gaurav 2012/12/12 02:23:38 Done.
+};
+
+namespace api {
+
+class DeveloperPrivateAutoUpdateFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.autoUpdate");
+
+ protected:
+ virtual ~DeveloperPrivateAutoUpdateFunction() {}
miket_OOO 2012/12/06 19:31:15 See http://dev.chromium.org/developers/coding-styl
Gaurav 2012/12/12 02:23:38 Done.
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+class DeveloperPrivateGetItemsInfoFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getItemsInfo");
+
+ protected:
+ virtual ~DeveloperPrivateGetItemsInfoFunction() {}
miket_OOO 2012/12/06 19:31:15 Same as above.
Gaurav 2012/12/12 02:23:38 Done.
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+class DeveloperPrivateInspectFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.inspect");
+
+ protected:
+ virtual ~DeveloperPrivateInspectFunction() {}
miket_OOO 2012/12/06 19:31:15 etc.
Gaurav 2012/12/12 02:23:38 Done.
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+} // namespace api
miket_OOO 2012/12/06 19:31:15 vertical whitespace always exactly two spaces bef
Gaurav 2012/12/12 02:23:38 Done.
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_

Powered by Google App Engine
This is Rietveld 408576698