Chromium Code Reviews| Index: chrome/browser/extensions/platform_app_redirector.h |
| diff --git a/chrome/browser/extensions/platform_app_redirector.h b/chrome/browser/extensions/platform_app_redirector.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..965d83f9c927510992d01356d4238ce3b8583809 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/platform_app_redirector.h |
| @@ -0,0 +1,60 @@ |
| +// 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_PLATFORM_APP_REDIRECTOR_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REDIRECTOR_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +class ExtensionSet; |
| +class GURL; |
| +class Profile; |
| + |
| +namespace content { |
| +class NotificationDetails; |
| +class NotificationSource; |
| +} |
| + |
| +namespace extensions { |
| + |
| +// This class listens to notifications related to redirecting URLs to platform |
| +// apps (in particular related to the 'url_handlers' manifest key), and launches |
| +// a handling app for the requested URL. A handling app must exist before a |
| +// notification is sent. |
| +// |
| +// Also provides a direct way of launching a possible handling app for a given |
| +// URL (in that case, an app doesn't have to exist). |
| +class PlatformAppRedirector : public content::NotificationObserver { |
|
not at google - send to devlin
2013/08/29 17:35:56
I think this class needs a virtual destructor? Tho
sergeygs
2013/08/30 00:39:44
Done. Clang indeed didn't complain, but a virtual
|
| + public: |
| + PlatformAppRedirector(Profile* profile); |
|
not at google - send to devlin
2013/08/29 17:35:56
explicit
sergeygs
2013/08/30 00:39:44
Done.
|
| + |
| + // Looks for an app that's registered itself for handling a URL pattern |
| + // matching |url|. If found, launches the app by issuing an onLaunched event |
| + // to it, with |url| and |referrer_url| available through the launch data. |
| + bool MaybeLaunchPlatformAppWithUrl(const GURL& url, |
| + const GURL& referrer_url) const; |
| + |
| + // content::NotificationObserver |
| + virtual void Observe(int type, |
|
not at google - send to devlin
2013/08/29 17:35:56
private
sergeygs
2013/08/30 00:39:44
Done.
|
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + private: |
| + // The normal profile associated with this ExtensionService. |
| + Profile* profile_; |
| + |
| + // Alias to the extension set in the ExtensionService associated with the |
| + // profile above. |
| + const ExtensionSet* extensions_; |
| + |
| + content::NotificationRegistrar registrar_; |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REDIRECTOR_H_ |