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

Side by Side Diff: chrome/browser/extensions/app_notify_channel_setup.h

Issue 8194005: Relanding: Add js api for hosted/packaged apps to request notification authorization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/app_notify_channel_setup.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "googleurl/src/gurl.h"
11
12 // This class uses the browser login credentials to fetch a channel ID for an
13 // app to use when sending server push notifications.
14 class AppNotifyChannelSetup
15 : public base::RefCountedThreadSafe<AppNotifyChannelSetup> {
16 public:
17 class Delegate {
18 public:
19 // If successful, |channel_id| will be non-empty. On failure, |channel_id|
20 // will be empty and |error| will contain an error to report to the JS
21 // callback.
22 virtual void AppNotifyChannelSetupComplete(int request_id,
23 const std::string& channel_id,
24 const std::string& error) = 0;
25 };
26
27 AppNotifyChannelSetup(int request_id,
28 const std::string& client_id,
29 const GURL& requestor_url,
30 base::WeakPtr<Delegate> delegate);
31
32 // This begins the process of fetching the channel id using the browser login
33 // credentials. If the user isn't logged in to chrome, this will first cause a
34 // prompt to appear asking the user to log in.
35 void Start();
36
37 private:
38 friend class base::RefCountedThreadSafe<AppNotifyChannelSetup>;
39
40 virtual ~AppNotifyChannelSetup();
41
42 void ReportResult(const std::string& channel_id, const std::string& error);
43
44 int request_id_;
45 std::string client_id_;
46 GURL requestor_url_;
47 base::WeakPtr<Delegate> delegate_;
48
49 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup);
50 };
51
52 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_notify_channel_setup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698