OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_ | |
6 #define CHROME_BROWSER_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "chrome/browser/content_settings/permission_request_id.h" | |
10 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | |
11 #include "chrome/common/content_settings_types.h" | |
12 | |
13 class GURL; | |
14 | |
15 // TODO(miguelg): move this class out of GCM. | |
16 namespace gcm { | |
17 | |
18 class PermissionContextBase; | |
19 | |
20 // Default implementation of PermissionBubbleRequest, it is assumed that the | |
21 // caller owns it and that it can be deleted once the |delete_callback| | |
22 // is executed. | |
23 class PermissionBubbleRequestImpl : public PermissionBubbleRequest { | |
24 public: | |
25 | |
26 typedef base::Callback<void(bool persist_permission, bool grant_permission)> | |
27 PermissionDecidedCallback; | |
28 | |
29 PermissionBubbleRequestImpl( | |
30 const GURL& request_origin, | |
31 bool user_gesture, | |
32 ContentSettingsType type, | |
33 const std::string& display_languages, | |
34 const PermissionDecidedCallback permission_decided_callback, | |
35 const base::Closure delete_callback); | |
36 | |
37 virtual ~PermissionBubbleRequestImpl(); | |
38 | |
39 // PermissionBubbleRequest: | |
40 virtual int GetIconID() const OVERRIDE; | |
41 virtual base::string16 GetMessageText() const OVERRIDE; | |
42 virtual base::string16 GetMessageTextFragment() const OVERRIDE; | |
43 virtual bool HasUserGesture() const OVERRIDE; | |
44 | |
45 // TODO(miguelg) Change this method to GetOrigin() | |
46 virtual GURL GetRequestingHostname() const OVERRIDE; | |
47 virtual void PermissionGranted() OVERRIDE; | |
48 virtual void PermissionDenied() OVERRIDE; | |
49 virtual void Cancelled() OVERRIDE; | |
50 virtual void RequestFinished() OVERRIDE; | |
51 | |
52 private: | |
53 GURL request_origin_; | |
54 bool user_gesture_; | |
55 ContentSettingsType type_; | |
56 std::string display_languages_; | |
57 | |
58 // Called once a decision is made about the permission. | |
59 const PermissionDecidedCallback permission_decided_callback_; | |
60 | |
61 // Called when the bubble is no longer in use so it can be deleted by | |
62 // the caller. | |
63 const base::Closure delete_callback_; | |
64 bool is_finished_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleRequestImpl); | |
67 }; | |
68 | |
69 } // namespace gcm | |
70 #endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_ | |
OLD | NEW |