OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
20 #include "chrome/app/chrome_command_ids.h" | 20 #include "chrome/app/chrome_command_ids.h" |
21 #include "chrome/app/chrome_dll_resource.h" | 21 #include "chrome/app/chrome_dll_resource.h" |
22 #include "chrome/browser/app_mode/app_mode_utils.h" | 22 #include "chrome/browser/app_mode/app_mode_utils.h" |
23 #include "chrome/browser/bookmarks/bookmark_stats.h" | 23 #include "chrome/browser/bookmarks/bookmark_stats.h" |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
26 #include "chrome/browser/extensions/extension_util.h" | 26 #include "chrome/browser/extensions/extension_util.h" |
27 #include "chrome/browser/extensions/tab_helper.h" | 27 #include "chrome/browser/extensions/tab_helper.h" |
28 #include "chrome/browser/infobars/infobar_service.h" | 28 #include "chrome/browser/infobars/infobar_service.h" |
| 29 #include "chrome/browser/mojo_runner_util.h" |
29 #include "chrome/browser/native_window_notification_source.h" | 30 #include "chrome/browser/native_window_notification_source.h" |
30 #include "chrome/browser/profiles/avatar_menu.h" | 31 #include "chrome/browser/profiles/avatar_menu.h" |
31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 33 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
33 #include "chrome/browser/profiles/profile_info_cache.h" | 34 #include "chrome/browser/profiles/profile_info_cache.h" |
34 #include "chrome/browser/profiles/profile_manager.h" | 35 #include "chrome/browser/profiles/profile_manager.h" |
35 #include "chrome/browser/profiles/profile_window.h" | 36 #include "chrome/browser/profiles/profile_window.h" |
36 #include "chrome/browser/profiles/profiles_state.h" | 37 #include "chrome/browser/profiles/profiles_state.h" |
37 #include "chrome/browser/search/search.h" | 38 #include "chrome/browser/search/search.h" |
38 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 39 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 // immersive fullscreen doesn't exist. | 2376 // immersive fullscreen doesn't exist. |
2376 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || | 2377 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || |
2377 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { | 2378 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { |
2378 return false; | 2379 return false; |
2379 } | 2380 } |
2380 | 2381 |
2381 return url.is_empty(); | 2382 return url.is_empty(); |
2382 } | 2383 } |
2383 | 2384 |
2384 void BrowserView::LoadAccelerators() { | 2385 void BrowserView::LoadAccelerators() { |
| 2386 // TODO(beng): for some reason GetFocusManager() returns null in this case, |
| 2387 // investigate, but for now just disable accelerators in this |
| 2388 // mode. |
| 2389 if (IsRunningInMojoRunner()) |
| 2390 return; |
| 2391 |
2385 views::FocusManager* focus_manager = GetFocusManager(); | 2392 views::FocusManager* focus_manager = GetFocusManager(); |
2386 DCHECK(focus_manager); | 2393 DCHECK(focus_manager); |
2387 | 2394 |
2388 // Let's fill our own accelerator table. | 2395 // Let's fill our own accelerator table. |
2389 const bool is_app_mode = chrome::IsRunningInForcedAppMode(); | 2396 const bool is_app_mode = chrome::IsRunningInForcedAppMode(); |
2390 const std::vector<chrome::AcceleratorMapping> accelerator_list( | 2397 const std::vector<chrome::AcceleratorMapping> accelerator_list( |
2391 chrome::GetAcceleratorList()); | 2398 chrome::GetAcceleratorList()); |
2392 for (std::vector<chrome::AcceleratorMapping>::const_iterator it = | 2399 for (std::vector<chrome::AcceleratorMapping>::const_iterator it = |
2393 accelerator_list.begin(); it != accelerator_list.end(); ++it) { | 2400 accelerator_list.begin(); it != accelerator_list.end(); ++it) { |
2394 // In app mode, only allow accelerators of white listed commands to pass | 2401 // In app mode, only allow accelerators of white listed commands to pass |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 return immersive_mode_controller()->IsEnabled(); | 2649 return immersive_mode_controller()->IsEnabled(); |
2643 } | 2650 } |
2644 | 2651 |
2645 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2652 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2646 return GetWidget(); | 2653 return GetWidget(); |
2647 } | 2654 } |
2648 | 2655 |
2649 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2656 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2650 return top_container_->GetBoundsInScreen(); | 2657 return top_container_->GetBoundsInScreen(); |
2651 } | 2658 } |
OLD | NEW |