| Index: apps/url_redirector.h
|
| diff --git a/apps/url_redirector.h b/apps/url_redirector.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d264b94d3fd5390a39dc7599a4dababe66652f6e
|
| --- /dev/null
|
| +++ b/apps/url_redirector.h
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 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 APPS_URL_REDIRECTOR_H_
|
| +#define APPS_URL_REDIRECTOR_H_
|
| +
|
| +#include "content/public/browser/web_contents_observer.h"
|
| +#include "content/public/browser/web_contents_user_data.h"
|
| +
|
| +class ExtensionSet;
|
| +class GURL;
|
| +class Profile;
|
| +
|
| +namespace apps {
|
| +
|
| +// This class observes a WebContent and handles IPCs related to redirecting URLs
|
| +// to apps (in particular related to the 'url_handlers' manifest key), launching
|
| +// a handling app for the requested URL.
|
| +//
|
| +// Also provides a static convenience wrapper to maybe find and launch
|
| +// a handler app for a given URL, if any.
|
| +class UrlRedirector : public content::WebContentsObserver,
|
| + public content::WebContentsUserData<UrlRedirector> {
|
| + public:
|
| + virtual ~UrlRedirector();
|
| +
|
| + // Looks for an app that's registered itself for handling a URL pattern
|
| + // that matches |url|. If found, launches the app by issuing an onLaunched
|
| + // event with |url| and |referrer_url| available through the launch data,
|
| + // and returns true. Otherwise, returns false.
|
| + static bool MaybeLaunchAppWithUrl(Profile* profile,
|
| + const GURL& url,
|
| + const GURL& referrer_url);
|
| +
|
| + private:
|
| + explicit UrlRedirector(content::WebContents* web_contents);
|
| + friend class content::WebContentsUserData<UrlRedirector>;
|
| +
|
| + // content::WebContentsObserver
|
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| +
|
| + void LaunchAppWithUrl(const GURL& url, const GURL& referrer_url) const;
|
| +
|
| + // The normal profile associated with this ExtensionService.
|
| + Profile* profile_;
|
| +};
|
| +
|
| +} // namespace apps
|
| +
|
| +#endif // APPS_URL_REDIRECTOR_H_
|
|
|