| 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" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #include "content/public/browser/web_contents_view.h" | 109 #include "content/public/browser/web_contents_view.h" |
| 110 #include "content/public/common/content_switches.h" | 110 #include "content/public/common/content_switches.h" |
| 111 #include "grit/chromium_strings.h" | 111 #include "grit/chromium_strings.h" |
| 112 #include "grit/generated_resources.h" | 112 #include "grit/generated_resources.h" |
| 113 #include "grit/locale_settings.h" | 113 #include "grit/locale_settings.h" |
| 114 #include "grit/theme_resources.h" | 114 #include "grit/theme_resources.h" |
| 115 #include "grit/ui_resources.h" | 115 #include "grit/ui_resources.h" |
| 116 #include "grit/ui_strings.h" | 116 #include "grit/ui_strings.h" |
| 117 #include "grit/webkit_resources.h" | 117 #include "grit/webkit_resources.h" |
| 118 #include "ui/accessibility/ax_view_state.h" | 118 #include "ui/accessibility/ax_view_state.h" |
| 119 #include "ui/aura/client/window_tree_client.h" |
| 120 #include "ui/aura/window.h" |
| 121 #include "ui/aura/window_tree_host.h" |
| 119 #include "ui/base/accelerators/accelerator.h" | 122 #include "ui/base/accelerators/accelerator.h" |
| 120 #include "ui/base/hit_test.h" | 123 #include "ui/base/hit_test.h" |
| 121 #include "ui/base/l10n/l10n_util.h" | 124 #include "ui/base/l10n/l10n_util.h" |
| 122 #include "ui/base/resource/resource_bundle.h" | 125 #include "ui/base/resource/resource_bundle.h" |
| 123 #include "ui/base/theme_provider.h" | 126 #include "ui/base/theme_provider.h" |
| 124 #include "ui/events/event_utils.h" | 127 #include "ui/events/event_utils.h" |
| 125 #include "ui/gfx/canvas.h" | 128 #include "ui/gfx/canvas.h" |
| 126 #include "ui/gfx/color_utils.h" | 129 #include "ui/gfx/color_utils.h" |
| 127 #include "ui/gfx/rect_conversions.h" | 130 #include "ui/gfx/rect_conversions.h" |
| 131 #include "ui/gfx/screen.h" |
| 128 #include "ui/gfx/sys_color_change_listener.h" | 132 #include "ui/gfx/sys_color_change_listener.h" |
| 129 #include "ui/views/controls/button/menu_button.h" | 133 #include "ui/views/controls/button/menu_button.h" |
| 130 #include "ui/views/controls/textfield/textfield.h" | 134 #include "ui/views/controls/textfield/textfield.h" |
| 131 #include "ui/views/controls/webview/webview.h" | 135 #include "ui/views/controls/webview/webview.h" |
| 132 #include "ui/views/focus/external_focus_tracker.h" | 136 #include "ui/views/focus/external_focus_tracker.h" |
| 133 #include "ui/views/focus/view_storage.h" | 137 #include "ui/views/focus/view_storage.h" |
| 134 #include "ui/views/layout/grid_layout.h" | 138 #include "ui/views/layout/grid_layout.h" |
| 135 #include "ui/views/widget/native_widget.h" | 139 #include "ui/views/widget/native_widget.h" |
| 136 #include "ui/views/widget/root_view.h" | 140 #include "ui/views/widget/root_view.h" |
| 137 #include "ui/views/widget/widget.h" | 141 #include "ui/views/widget/widget.h" |
| 138 #include "ui/views/window/dialog_delegate.h" | 142 #include "ui/views/window/dialog_delegate.h" |
| 139 | 143 |
| 140 #if defined(USE_ASH) | 144 #if defined(USE_ASH) |
| 141 #include "ash/ash_switches.h" | 145 #include "ash/ash_switches.h" |
| 142 #include "ash/shelf/shelf.h" | 146 #include "ash/shelf/shelf.h" |
| 143 #include "ash/shelf/shelf_model.h" | 147 #include "ash/shelf/shelf_model.h" |
| 144 #include "ash/shell.h" | 148 #include "ash/shell.h" |
| 145 #include "chrome/browser/ui/ash/ash_util.h" | 149 #include "chrome/browser/ui/ash/ash_util.h" |
| 146 #endif | 150 #endif |
| 147 | 151 |
| 148 #if defined(USE_AURA) | |
| 149 #include "ui/aura/client/window_tree_client.h" | |
| 150 #include "ui/aura/window.h" | |
| 151 #include "ui/aura/window_tree_host.h" | |
| 152 #include "ui/gfx/screen.h" | |
| 153 #endif | |
| 154 | |
| 155 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
| 156 #include "base/win/windows_version.h" | 153 #include "base/win/windows_version.h" |
| 157 #include "chrome/browser/jumplist_win.h" | 154 #include "chrome/browser/jumplist_win.h" |
| 158 #include "ui/views/win/scoped_fullscreen_visibility.h" | 155 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 159 #endif | 156 #endif |
| 160 | 157 |
| 161 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 158 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 162 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" | 159 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
| 163 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" | 160 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" |
| 164 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 161 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
| (...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2289 void BrowserView::InitHangMonitor() { | 2286 void BrowserView::InitHangMonitor() { |
| 2290 #if defined(OS_WIN) | 2287 #if defined(OS_WIN) |
| 2291 PrefService* pref_service = g_browser_process->local_state(); | 2288 PrefService* pref_service = g_browser_process->local_state(); |
| 2292 if (!pref_service) | 2289 if (!pref_service) |
| 2293 return; | 2290 return; |
| 2294 | 2291 |
| 2295 int plugin_message_response_timeout = | 2292 int plugin_message_response_timeout = |
| 2296 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout); | 2293 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout); |
| 2297 int hung_plugin_detect_freq = | 2294 int hung_plugin_detect_freq = |
| 2298 pref_service->GetInteger(prefs::kHungPluginDetectFrequency); | 2295 pref_service->GetInteger(prefs::kHungPluginDetectFrequency); |
| 2299 #if defined(USE_AURA) | |
| 2300 HWND window = GetWidget()->GetNativeView()->GetHost()-> | 2296 HWND window = GetWidget()->GetNativeView()->GetHost()-> |
| 2301 GetAcceleratedWidget(); | 2297 GetAcceleratedWidget(); |
| 2302 #else | |
| 2303 HWND window = GetWidget()->GetNativeView(); | |
| 2304 #endif | |
| 2305 if ((hung_plugin_detect_freq > 0) && | 2298 if ((hung_plugin_detect_freq > 0) && |
| 2306 hung_window_detector_.Initialize(window, | 2299 hung_window_detector_.Initialize(window, |
| 2307 plugin_message_response_timeout)) { | 2300 plugin_message_response_timeout)) { |
| 2308 ticker_.set_tick_interval(hung_plugin_detect_freq); | 2301 ticker_.set_tick_interval(hung_plugin_detect_freq); |
| 2309 ticker_.RegisterTickHandler(&hung_window_detector_); | 2302 ticker_.RegisterTickHandler(&hung_window_detector_); |
| 2310 ticker_.Start(); | 2303 ticker_.Start(); |
| 2311 | 2304 |
| 2312 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout, | 2305 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout, |
| 2313 plugin_message_response_timeout); | 2306 plugin_message_response_timeout); |
| 2314 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, | 2307 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 textfield->ExecuteCommand(command_id); | 2502 textfield->ExecuteCommand(command_id); |
| 2510 } | 2503 } |
| 2511 } | 2504 } |
| 2512 | 2505 |
| 2513 bool BrowserView::DoCutCopyPasteForWebContents( | 2506 bool BrowserView::DoCutCopyPasteForWebContents( |
| 2514 WebContents* contents, | 2507 WebContents* contents, |
| 2515 void (WebContents::*method)()) { | 2508 void (WebContents::*method)()) { |
| 2516 gfx::NativeView native_view = contents->GetView()->GetContentNativeView(); | 2509 gfx::NativeView native_view = contents->GetView()->GetContentNativeView(); |
| 2517 if (!native_view) | 2510 if (!native_view) |
| 2518 return false; | 2511 return false; |
| 2519 #if defined(USE_AURA) | |
| 2520 if (native_view->HasFocus()) { | 2512 if (native_view->HasFocus()) { |
| 2521 #elif defined(OS_WIN) | |
| 2522 if (native_view == ::GetFocus()) { | |
| 2523 #endif | |
| 2524 (contents->*method)(); | 2513 (contents->*method)(); |
| 2525 return true; | 2514 return true; |
| 2526 } | 2515 } |
| 2527 | 2516 |
| 2528 return false; | 2517 return false; |
| 2529 } | 2518 } |
| 2530 | 2519 |
| 2531 void BrowserView::ActivateAppModalDialog() const { | 2520 void BrowserView::ActivateAppModalDialog() const { |
| 2532 // If another browser is app modal, flash and activate the modal browser. | 2521 // If another browser is app modal, flash and activate the modal browser. |
| 2533 AppModalDialog* active_dialog = | 2522 AppModalDialog* active_dialog = |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2553 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2542 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2554 gfx::Point icon_bottom( | 2543 gfx::Point icon_bottom( |
| 2555 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2544 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2556 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2545 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2557 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2546 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2558 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2547 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2559 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2548 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2560 } | 2549 } |
| 2561 return top_arrow_height; | 2550 return top_arrow_height; |
| 2562 } | 2551 } |
| OLD | NEW |