OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_view_host.h" | 5 #include "chrome/browser/extensions/extension_view_host.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Only allow these from hosts that are bound to a browser (e.g. popups). | 158 // Only allow these from hosts that are bound to a browser (e.g. popups). |
159 // Otherwise they are not driven by a user gesture. | 159 // Otherwise they are not driven by a user gesture. |
160 Browser* browser = view_->GetBrowser(); | 160 Browser* browser = view_->GetBrowser(); |
161 return browser ? browser->OpenURL(params) : NULL; | 161 return browser ? browser->OpenURL(params) : NULL; |
162 } | 162 } |
163 default: | 163 default: |
164 return NULL; | 164 return NULL; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 bool ExtensionViewHost::ShouldTransferNavigation( | |
169 bool is_main_frame_navigation) { | |
170 // Block navigations that cause main frame of an extension pop-up (or | |
171 // background page) to navigate to non-extension content (i.e. to web | |
172 // content). | |
173 return !is_main_frame_navigation; | |
174 } | |
175 | |
176 bool ExtensionViewHost::PreHandleKeyboardEvent( | 168 bool ExtensionViewHost::PreHandleKeyboardEvent( |
177 WebContents* source, | 169 WebContents* source, |
178 const NativeWebKeyboardEvent& event, | 170 const NativeWebKeyboardEvent& event, |
179 bool* is_keyboard_shortcut) { | 171 bool* is_keyboard_shortcut) { |
180 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP && | 172 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP && |
181 event.type == NativeWebKeyboardEvent::RawKeyDown && | 173 event.type == NativeWebKeyboardEvent::RawKeyDown && |
182 event.windowsKeyCode == ui::VKEY_ESCAPE) { | 174 event.windowsKeyCode == ui::VKEY_ESCAPE) { |
183 DCHECK(is_keyboard_shortcut != NULL); | 175 DCHECK(is_keyboard_shortcut != NULL); |
184 *is_keyboard_shortcut = true; | 176 *is_keyboard_shortcut = true; |
185 return false; | 177 return false; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const content::NotificationSource& source, | 298 const content::NotificationSource& source, |
307 const content::NotificationDetails& details) { | 299 const content::NotificationDetails& details) { |
308 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY); | 300 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY); |
309 DCHECK(ExtensionSystem::Get(browser_context()) | 301 DCHECK(ExtensionSystem::Get(browser_context()) |
310 ->runtime_data() | 302 ->runtime_data() |
311 ->IsBackgroundPageReady(extension())); | 303 ->IsBackgroundPageReady(extension())); |
312 LoadInitialURL(); | 304 LoadInitialURL(); |
313 } | 305 } |
314 | 306 |
315 } // namespace extensions | 307 } // namespace extensions |
OLD | NEW |