| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/values.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class DictionaryValue; | 14 class DictionaryValue; |
| 14 } // namespace base | 15 } // namespace base |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace guest_view { |
| 18 |
| 17 class GuestViewBase; | 19 class GuestViewBase; |
| 18 } // namespace extensions | |
| 19 | |
| 20 namespace guestview { | |
| 21 | 20 |
| 22 // A GuestViewManagerDelegate interface allows GuestViewManager to delegate | 21 // A GuestViewManagerDelegate interface allows GuestViewManager to delegate |
| 23 // responsibilities to other modules in Chromium. Different builds of Chromium | 22 // responsibilities to other modules in Chromium. Different builds of Chromium |
| 24 // may use different GuestViewManagerDelegate implementations. For example, | 23 // may use different GuestViewManagerDelegate implementations. For example, |
| 25 // mobile builds of Chromium do not include an extensions module and so | 24 // mobile builds of Chromium do not include an extensions module and so |
| 26 // permission checks would be different, and IsOwnedByExtension would always | 25 // permission checks would be different, and IsOwnedByExtension would always |
| 27 // return false. | 26 // return false. |
| 28 class GuestViewManagerDelegate { | 27 class GuestViewManagerDelegate { |
| 29 public: | 28 public: |
| 30 virtual ~GuestViewManagerDelegate() {} | 29 GuestViewManagerDelegate(); |
| 30 virtual ~GuestViewManagerDelegate(); |
| 31 | 31 |
| 32 // Dispatches the event with |name| with the provided |args| to the embedder | 32 // Dispatches the event with |name| with the provided |args| to the embedder |
| 33 // of the given |guest| with |instance_id| for routing. | 33 // of the given |guest| with |instance_id| for routing. |
| 34 virtual void DispatchEvent(const std::string& event_name, | 34 virtual void DispatchEvent(const std::string& event_name, |
| 35 scoped_ptr<base::DictionaryValue> args, | 35 scoped_ptr<base::DictionaryValue> args, |
| 36 extensions::GuestViewBase* guest, | 36 GuestViewBase* guest, |
| 37 int instance_id) = 0; | 37 int instance_id) {} |
| 38 | 38 |
| 39 // Indicates whether the |guest| can be used within the context of where it | 39 // Indicates whether the |guest| can be used within the context of where it |
| 40 // was created. | 40 // was created. |
| 41 virtual bool IsGuestAvailableToContext(extensions::GuestViewBase* guest) = 0; | 41 virtual bool IsGuestAvailableToContext(GuestViewBase* guest); |
| 42 | 42 |
| 43 // Indicates whether the |guest| is owned by an extension or Chrome App. | 43 // Indicates whether the |guest| is owned by an extension or Chrome App. |
| 44 virtual bool IsOwnedByExtension(extensions::GuestViewBase* guest) = 0; | 44 virtual bool IsOwnedByExtension(GuestViewBase* guest); |
| 45 | 45 |
| 46 // Registers additional GuestView types the delegator (GuestViewManger) can | 46 // Registers additional GuestView types the delegator (GuestViewManger) can |
| 47 // create. | 47 // create. |
| 48 virtual void RegisterAdditionalGuestViewTypes() = 0; | 48 virtual void RegisterAdditionalGuestViewTypes() {} |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace guestview | 51 } // namespace guest_view |
| 52 | 52 |
| 53 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_ | 53 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_ |
| OLD | NEW |