Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / permissions / permission_bubble_request_impl.h
blobfc2f9ceab0f8eeea2bcc77414dafe5772b34fc82
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.
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_BUBBLE_REQUEST_IMPL_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_BUBBLE_REQUEST_IMPL_H_
8 #include "base/callback.h"
9 #include "chrome/browser/permissions/permission_request_id.h"
10 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
11 #include "components/content_settings/core/common/content_settings.h"
12 #include "components/content_settings/core/common/content_settings_types.h"
14 class GURL;
15 class PermissionContextBase;
17 // Default implementation of PermissionBubbleRequest, it is assumed that the
18 // caller owns it and that it can be deleted once the |delete_callback|
19 // is executed.
20 class PermissionBubbleRequestImpl : public PermissionBubbleRequest {
21 public:
22 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>;
24 PermissionBubbleRequestImpl(
25 const GURL& request_origin,
26 bool user_gesture,
27 ContentSettingsType type,
28 const std::string& display_languages,
29 const PermissionDecidedCallback& permission_decided_callback,
30 const base::Closure delete_callback);
32 ~PermissionBubbleRequestImpl() override;
34 // PermissionBubbleRequest:
35 gfx::VectorIconId GetVectorIconId() const override;
36 int GetIconID() const override;
37 base::string16 GetMessageText() const override;
38 base::string16 GetMessageTextFragment() const override;
39 bool HasUserGesture() const override;
41 // TODO(miguelg) Change this method to GetOrigin()
42 GURL GetRequestingHostname() const override;
44 // Remember to call RegisterActionTaken for these methods if you are
45 // overriding them.
46 void PermissionGranted() override;
47 void PermissionDenied() override;
48 void Cancelled() override;
49 void RequestFinished() override;
51 protected:
52 void RegisterActionTaken() { action_taken_ = true; }
54 private:
55 GURL request_origin_;
56 bool user_gesture_;
57 ContentSettingsType type_;
58 std::string display_languages_;
60 // Called once a decision is made about the permission.
61 const PermissionDecidedCallback permission_decided_callback_;
63 // Called when the bubble is no longer in use so it can be deleted by
64 // the caller.
65 const base::Closure delete_callback_;
66 bool is_finished_;
67 bool action_taken_;
69 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleRequestImpl);
72 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_BUBBLE_REQUEST_IMPL_H_