Roll ANGLE cc54ab3..c5b2ba5
[chromium-blink-merge.git] / components / guest_view / browser / guest_view_manager_delegate.h
blob9a56633642fb3a271898a4dcd87acbdb9a39a682
1 // Copyright 2015 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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_
6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
13 namespace base {
14 class DictionaryValue;
15 } // namespace base
17 namespace content {
18 class WebContents;
19 } // namespace content
21 namespace guest_view {
23 class GuestViewBase;
25 // A GuestViewManagerDelegate interface allows GuestViewManager to delegate
26 // responsibilities to other modules in Chromium. Different builds of Chromium
27 // may use different GuestViewManagerDelegate implementations. For example,
28 // mobile builds of Chromium do not include an extensions module and so
29 // permission checks would be different, and IsOwnedByExtension would always
30 // return false.
31 class GuestViewManagerDelegate {
32 public:
33 GuestViewManagerDelegate();
34 virtual ~GuestViewManagerDelegate();
36 // Attaches the task-manager-specific tag for the GuestViews to its
37 // |guest_web_contents| so that their corresponding tasks show up in the task
38 // manager.
39 virtual void AttachTaskManagerGuestTag(
40 content::WebContents* guest_web_contents) const {}
42 // Dispatches the event with |name| with the provided |args| to the embedder
43 // of the given |guest| with |instance_id| for routing.
44 virtual void DispatchEvent(const std::string& event_name,
45 scoped_ptr<base::DictionaryValue> args,
46 GuestViewBase* guest,
47 int instance_id) {}
49 // Indicates whether the |guest| can be used within the context of where it
50 // was created.
51 virtual bool IsGuestAvailableToContext(GuestViewBase* guest);
53 // Indicates whether the |guest| is owned by an extension or Chrome App.
54 virtual bool IsOwnedByExtension(GuestViewBase* guest);
56 // Registers additional GuestView types the delegator (GuestViewManger) can
57 // create.
58 virtual void RegisterAdditionalGuestViewTypes() {}
61 } // namespace guest_view
63 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_