OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" | 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" |
7 | 7 |
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
9 #include "chrome/browser/favicon/favicon_helper.h" | 9 #include "chrome/browser/favicon/favicon_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
63 chromeos::AccessibilityManager* accessibility_manager = | 63 chromeos::AccessibilityManager* accessibility_manager = |
64 chromeos::AccessibilityManager::Get(); | 64 chromeos::AccessibilityManager::Get(); |
65 CHECK(accessibility_manager); | 65 CHECK(accessibility_manager); |
66 accessibility_subscription_ = accessibility_manager->RegisterCallback( | 66 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
67 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged, | 67 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged, |
68 weak_ptr_factory_.GetWeakPtr())); | 68 weak_ptr_factory_.GetWeakPtr())); |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
72 void ChromeWebViewGuestDelegate::OnGuestDestroyed() { | |
73 // Clean up custom context menu items for this guest. | |
74 MenuManager* menu_manager = MenuManager::Get( | |
75 Profile::FromBrowserContext(web_view_guest()->browser_context())); | |
76 menu_manager->RemoveAllContextItems(MenuItem::ExtensionKey( | |
77 web_view_guest()->owner_host(), | |
78 web_view_guest()->view_instance_id())); | |
79 } | |
80 | |
81 // static | 72 // static |
82 scoped_ptr<base::ListValue> ChromeWebViewGuestDelegate::MenuModelToValue( | 73 scoped_ptr<base::ListValue> ChromeWebViewGuestDelegate::MenuModelToValue( |
83 const ui::SimpleMenuModel& menu_model) { | 74 const ui::SimpleMenuModel& menu_model) { |
84 scoped_ptr<base::ListValue> items(new base::ListValue()); | 75 scoped_ptr<base::ListValue> items(new base::ListValue()); |
85 for (int i = 0; i < menu_model.GetItemCount(); ++i) { | 76 for (int i = 0; i < menu_model.GetItemCount(); ++i) { |
86 base::DictionaryValue* item_value = new base::DictionaryValue(); | 77 base::DictionaryValue* item_value = new base::DictionaryValue(); |
87 // TODO(lazyboy): We need to expose some kind of enum equivalent of | 78 // TODO(lazyboy): We need to expose some kind of enum equivalent of |
88 // |command_id| instead of plain integers. | 79 // |command_id| instead of plain integers. |
89 item_value->SetInteger(webview::kMenuItemCommandId, | 80 item_value->SetInteger(webview::kMenuItemCommandId, |
90 menu_model.GetCommandIdAt(i)); | 81 menu_model.GetCommandIdAt(i)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { | 126 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { |
136 if (details.enabled) | 127 if (details.enabled) |
137 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); | 128 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); |
138 else | 129 else |
139 chromevox_injected_ = false; | 130 chromevox_injected_ = false; |
140 } | 131 } |
141 } | 132 } |
142 #endif | 133 #endif |
143 | 134 |
144 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |