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

Unified Diff: chrome/browser/extensions/api/apps_debugger_private/apps_debugger_private_api.h

Issue 11428116: First few API implementation of AppsDebuggerPrivate. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 1 month 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/apps_debugger_private/apps_debugger_private_api.h
diff --git a/chrome/browser/extensions/api/apps_debugger_private/apps_debugger_private_api.h b/chrome/browser/extensions/api/apps_debugger_private/apps_debugger_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..9efc4d665e521e16b091a1c96df00f2aed670e5e
--- /dev/null
+++ b/chrome/browser/extensions/api/apps_debugger_private/apps_debugger_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_APPS_DEBUGGER_PRIVATE_APPS_DEBUGGER_PRIVATE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_APPS_DEBUGGER_PRIVATE_APPS_DEBUGGER_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 {
+namespace api {
+namespace apps_debugger_private {
+struct ItemInfo;
+struct ItemInspectView;
+}
+}
+class ExtensionSystem;
+}
+
+namespace apps_debugger = extensions::api::apps_debugger_private;
+
+typedef std::vector<linked_ptr<apps_debugger::ItemInfo> > ItemInfoList;
+typedef std::vector<linked_ptr<apps_debugger::ItemInspectView> >
+ ItemInspectViewList;
+
+namespace extensions {
+
+// The profile-keyed service that manages the AppsDebugger API.
+class AppsDebuggerAPI : public ProfileKeyedService,
+ public content::NotificationObserver {
+ public:
+ // Convenience method to get the AppsDebuggerAPI for a profile.
+ static AppsDebuggerAPI* Get(Profile* profile);
+
+ explicit AppsDebuggerAPI(Profile* profile);
+ virtual ~AppsDebuggerAPI();
+
+ 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:
+
+ void RegisterNotifications();
+
+ scoped_ptr<apps_debugger::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_;
+};
+
+namespace api {
+
+class AppsDebuggerPrivateAutoUpdateFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("appsDebuggerPrivate.autoUpdate");
+
+ protected:
+ virtual ~AppsDebuggerPrivateAutoUpdateFunction() {}
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+class AppsDebuggerPrivateGetItemsInfoFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("appsDebuggerPrivate.getItemsInfo");
+
+ protected:
+ virtual ~AppsDebuggerPrivateGetItemsInfoFunction() {}
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+class AppsDebuggerPrivateInspectFunction : public SyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("appsDebuggerPrivate.inspect");
+
+ protected:
+ virtual ~AppsDebuggerPrivateInspectFunction() {}
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+};
+
+} // namespace api
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_APPS_DEBUGGER_PRIVATE_APPS_DEBUGGER_PRIVATE_API_H_

Powered by Google App Engine
This is Rietveld 408576698