Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/guest_view/chrome_guest_view_manager_delegate.cc

Issue 1560553002: Framelet Prototype 2016 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + Applied Brett's Windows + Fixed security issue Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/guest_view/chrome_guest_view_manager_delegate.h" 5 #include "chrome/browser/guest_view/chrome_guest_view_manager_delegate.h"
6 6
7 #include "build/build_config.h" 7 #include "components/framelet/browser/framelet_guest.h"
8 #include "chrome/browser/task_management/web_contents_tags.h"
9 8
10 #if defined(OS_CHROMEOS) 9 namespace chrome {
11 #include "chrome/browser/chromeos/app_mode/app_session.h"
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
13 #endif
14
15 namespace extensions {
16 10
17 ChromeGuestViewManagerDelegate::ChromeGuestViewManagerDelegate( 11 ChromeGuestViewManagerDelegate::ChromeGuestViewManagerDelegate(
18 content::BrowserContext* context) 12 content::BrowserContext* context)
19 : ExtensionsGuestViewManagerDelegate(context) { 13 #if defined(ENABLE_EXTENSIONS)
14 : GuestViewManagerDelegateBase(context) {
15 #else
16 : GuestViewManagerDelegateBase(), context_(context) {
17 #endif
20 } 18 }
21 19
22 ChromeGuestViewManagerDelegate::~ChromeGuestViewManagerDelegate() { 20 ChromeGuestViewManagerDelegate::~ChromeGuestViewManagerDelegate() {
23 } 21 }
24 22
25 void ChromeGuestViewManagerDelegate::OnGuestAdded( 23 void ChromeGuestViewManagerDelegate::DispatchEvent(
26 content::WebContents* guest_web_contents) const { 24 const std::string& event_name,
27 // Attaches the task-manager-specific tag for the GuestViews to its 25 scoped_ptr<base::DictionaryValue> args,
28 // |guest_web_contents| so that their corresponding tasks show up in the task 26 guest_view::GuestViewBase* guest,
29 // manager. 27 int instance_id) {
30 task_management::WebContentsTags::CreateForGuestContents(guest_web_contents); 28 // TODO(paulmeyer): Implement special case for framelet.
31 29 GuestViewManagerDelegateBase::DispatchEvent(event_name, std::move(args),
32 #if defined(OS_CHROMEOS) 30 guest, instance_id);
33 // Notifies kiosk session about the added guest.
34 chromeos::AppSession* app_session =
35 chromeos::KioskAppManager::Get()->app_session();
36 if (app_session)
37 app_session->OnGuestAdded(guest_web_contents);
38 #endif
39 } 31 }
40 32
41 } // namespace extensions 33 bool ChromeGuestViewManagerDelegate::IsGuestAvailableToContext(
34 guest_view::GuestViewBase* guest) {
35 // Framelet is available in any context including the drive-by web.
36 if (guest->IsViewType(framelet::FrameletGuest::Type))
37 return true;
38 return GuestViewManagerDelegateBase::IsGuestAvailableToContext(guest);
39 }
40
41 void ChromeGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() {
42 guest_view::GuestViewManager* manager =
43 guest_view::GuestViewManager::FromBrowserContext(context_);
44 manager->RegisterGuestViewType<framelet::FrameletGuest>();
45 GuestViewManagerDelegateBase::RegisterAdditionalGuestViewTypes();
46 }
47
48 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698