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