OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/extensions/shell_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/shell_window_views.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 11 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
11 #include "chrome/common/extensions/draggable_region.h" | 12 #include "chrome/common/extensions/draggable_region.h" |
12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
13 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/browser/render_widget_host_view.h" | 15 #include "content/public/browser/render_widget_host_view.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
17 #include "grit/ui_resources.h" | 18 #include "grit/ui_resources.h" |
18 #include "grit/ui_strings.h" // Accessibility names | 19 #include "grit/ui_strings.h" // Accessibility names |
19 #include "third_party/skia/include/core/SkPaint.h" | 20 #include "third_party/skia/include/core/SkPaint.h" |
20 #include "ui/base/hit_test.h" | 21 #include "ui/base/hit_test.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 win_params.bounds); | 331 win_params.bounds); |
331 window_->SetBounds(window_bounds); | 332 window_->SetBounds(window_bounds); |
332 #if defined(OS_WIN) && !defined(USE_AURA) | 333 #if defined(OS_WIN) && !defined(USE_AURA) |
333 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( | 334 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( |
334 extension()->id()); | 335 extension()->id()); |
335 ui::win::SetAppIdForWindow( | 336 ui::win::SetAppIdForWindow( |
336 ShellIntegration::GetAppModelIdForProfile( | 337 ShellIntegration::GetAppModelIdForProfile( |
337 UTF8ToWide(app_name), shell_window_->profile()->GetPath()), | 338 UTF8ToWide(app_name), shell_window_->profile()->GetPath()), |
338 GetWidget()->GetTopLevelWidget()->GetNativeWindow()); | 339 GetWidget()->GetTopLevelWidget()->GetNativeWindow()); |
339 #endif | 340 #endif |
| 341 |
| 342 extension_keybinding_registry_.reset( |
| 343 new ExtensionKeybindingRegistryViews(shell_window_->profile(), |
| 344 window_->GetFocusManager(), |
| 345 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY)); |
| 346 |
340 OnViewWasResized(); | 347 OnViewWasResized(); |
341 | 348 |
342 window_->Show(); | 349 window_->Show(); |
343 } | 350 } |
344 | 351 |
345 views::View* ShellWindowViews::GetInitiallyFocusedView() { | 352 views::View* ShellWindowViews::GetInitiallyFocusedView() { |
346 return web_view_; | 353 return web_view_; |
347 } | 354 } |
348 | 355 |
349 bool ShellWindowViews::ShouldDescendIntoChildForEventHandling( | 356 bool ShellWindowViews::ShouldDescendIntoChildForEventHandling( |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 region.bounds.bottom(), | 626 region.bounds.bottom(), |
620 SkRegion::kDifference_Op); | 627 SkRegion::kDifference_Op); |
621 } | 628 } |
622 | 629 |
623 draggable_region_.reset(draggable_region); | 630 draggable_region_.reset(draggable_region); |
624 OnViewWasResized(); | 631 OnViewWasResized(); |
625 } | 632 } |
626 | 633 |
627 void ShellWindowViews::HandleKeyboardEvent( | 634 void ShellWindowViews::HandleKeyboardEvent( |
628 const content::NativeWebKeyboardEvent& event) { | 635 const content::NativeWebKeyboardEvent& event) { |
629 // No-op. | 636 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
| 637 GetFocusManager()); |
630 } | 638 } |
631 | 639 |
632 // static | 640 // static |
633 NativeShellWindow* NativeShellWindow::Create( | 641 NativeShellWindow* NativeShellWindow::Create( |
634 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 642 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
635 return new ShellWindowViews(shell_window, params); | 643 return new ShellWindowViews(shell_window, params); |
636 } | 644 } |
OLD | NEW |