Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 108413007: Enable the hung plugin detector on Win Aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 #if defined(USE_ASH) 134 #if defined(USE_ASH)
135 #include "ash/ash_switches.h" 135 #include "ash/ash_switches.h"
136 #include "ash/shelf/shelf.h" 136 #include "ash/shelf/shelf.h"
137 #include "ash/shelf/shelf_model.h" 137 #include "ash/shelf/shelf_model.h"
138 #include "ash/shell.h" 138 #include "ash/shell.h"
139 #include "chrome/browser/ui/ash/ash_util.h" 139 #include "chrome/browser/ui/ash/ash_util.h"
140 #endif 140 #endif
141 141
142 #if defined(USE_AURA) 142 #if defined(USE_AURA)
143 #include "ui/aura/root_window.h"
143 #include "ui/aura/window.h" 144 #include "ui/aura/window.h"
144 #include "ui/gfx/screen.h" 145 #include "ui/gfx/screen.h"
145 #elif defined(OS_WIN) // !defined(USE_AURA)
146 #include "chrome/browser/jumplist_win.h"
147 #include "ui/views/widget/native_widget_win.h"
148 #include "ui/views/win/scoped_fullscreen_visibility.h"
149 #endif 146 #endif
150 147
151 #if defined(OS_WIN) 148 #if defined(OS_WIN)
152 #include "base/win/windows_version.h" 149 #include "base/win/windows_version.h"
150 #include "chrome/browser/jumplist_win.h"
151 #include "ui/views/widget/native_widget_win.h"
152 #include "ui/views/win/scoped_fullscreen_visibility.h"
153 #include "win8/util/win8_util.h" 153 #include "win8/util/win8_util.h"
154 #endif 154 #endif
155 155
156 #if defined(ENABLE_ONE_CLICK_SIGNIN) 156 #if defined(ENABLE_ONE_CLICK_SIGNIN)
157 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" 157 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h"
158 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" 158 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h"
159 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" 159 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h"
160 #endif 160 #endif
161 161
162 #if defined(OS_CHROMEOS) 162 #if defined(OS_CHROMEOS)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 tabstrip_(NULL), 412 tabstrip_(NULL),
413 toolbar_(NULL), 413 toolbar_(NULL),
414 window_switcher_button_(NULL), 414 window_switcher_button_(NULL),
415 find_bar_host_view_(NULL), 415 find_bar_host_view_(NULL),
416 infobar_container_(NULL), 416 infobar_container_(NULL),
417 contents_web_view_(NULL), 417 contents_web_view_(NULL),
418 contents_container_(NULL), 418 contents_container_(NULL),
419 devtools_window_(NULL), 419 devtools_window_(NULL),
420 initialized_(false), 420 initialized_(false),
421 in_process_fullscreen_(false), 421 in_process_fullscreen_(false),
422 #if defined(OS_WIN) && !defined(USE_AURA) 422 #if defined(OS_WIN)
423 hung_window_detector_(&hung_plugin_action_), 423 hung_window_detector_(&hung_plugin_action_),
424 ticker_(0), 424 ticker_(0),
425 #endif 425 #endif
426 force_location_bar_focus_(false), 426 force_location_bar_focus_(false),
427 immersive_mode_controller_(chrome::CreateImmersiveModeController()), 427 immersive_mode_controller_(chrome::CreateImmersiveModeController()),
428 #if defined(OS_CHROMEOS) 428 #if defined(OS_CHROMEOS)
429 scroll_end_effect_controller_(ScrollEndEffectController::Create()), 429 scroll_end_effect_controller_(ScrollEndEffectController::Create()),
430 #endif 430 #endif
431 color_change_listener_(this), 431 color_change_listener_(this),
432 activate_modal_dialog_factory_(this) { 432 activate_modal_dialog_factory_(this) {
433 } 433 }
434 434
435 BrowserView::~BrowserView() { 435 BrowserView::~BrowserView() {
436 // Immersive mode may need to reparent views before they are removed/deleted. 436 // Immersive mode may need to reparent views before they are removed/deleted.
437 immersive_mode_controller_.reset(); 437 immersive_mode_controller_.reset();
438 438
439 browser_->tab_strip_model()->RemoveObserver(this); 439 browser_->tab_strip_model()->RemoveObserver(this);
440 440
441 #if defined(OS_WIN) && !defined(USE_AURA) 441 #if defined(OS_WIN)
442 // Stop hung plugin monitoring. 442 // Stop hung plugin monitoring.
443 ticker_.Stop(); 443 ticker_.Stop();
444 ticker_.UnregisterTickHandler(&hung_window_detector_); 444 ticker_.UnregisterTickHandler(&hung_window_detector_);
445 445
446 // Terminate the jumplist (must be called before browser_->profile() is 446 // Terminate the jumplist (must be called before browser_->profile() is
447 // destroyed. 447 // destroyed.
448 if (jumplist_) { 448 if (jumplist_) {
449 jumplist_->Terminate(); 449 jumplist_->Terminate();
450 } 450 }
451 #endif 451 #endif
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 this, 1999 this,
2000 top_container_, 2000 top_container_,
2001 tabstrip_, 2001 tabstrip_,
2002 toolbar_, 2002 toolbar_,
2003 infobar_container_, 2003 infobar_container_,
2004 contents_container_, 2004 contents_container_,
2005 GetContentsLayoutManager(), 2005 GetContentsLayoutManager(),
2006 immersive_mode_controller_.get()); 2006 immersive_mode_controller_.get());
2007 SetLayoutManager(browser_view_layout); 2007 SetLayoutManager(browser_view_layout);
2008 2008
2009 #if defined(OS_WIN) && !defined(USE_AURA) 2009 #if defined(OS_WIN)
2010 // Create a custom JumpList and add it to an observer of TabRestoreService 2010 // Create a custom JumpList and add it to an observer of TabRestoreService
2011 // so we can update the custom JumpList when a tab is added or removed. 2011 // so we can update the custom JumpList when a tab is added or removed.
2012 if (JumpList::Enabled()) { 2012 if (JumpList::Enabled()) {
2013 load_complete_listener_.reset(new LoadCompleteListener(this)); 2013 load_complete_listener_.reset(new LoadCompleteListener(this));
2014 } 2014 }
2015 #endif 2015 #endif
2016 2016
2017 GetLocationBar()->GetOmniboxView()->model()->popup_model()->AddObserver(this); 2017 GetLocationBar()->GetOmniboxView()->model()->popup_model()->AddObserver(this);
2018 } 2018 }
2019 2019
(...skipping 17 matching lines...) Expand all
2037 WebContents* web_contents = 2037 WebContents* web_contents =
2038 browser_->tab_strip_model()->GetActiveWebContents(); 2038 browser_->tab_strip_model()->GetActiveWebContents();
2039 // GetActiveWebContents can return NULL for example under Purify when 2039 // GetActiveWebContents can return NULL for example under Purify when
2040 // the animations are running slowly and this function is called on a timer 2040 // the animations are running slowly and this function is called on a timer
2041 // through LoadingAnimationCallback. 2041 // through LoadingAnimationCallback.
2042 frame_->UpdateThrobber(web_contents && web_contents->IsLoading()); 2042 frame_->UpdateThrobber(web_contents && web_contents->IsLoading());
2043 } 2043 }
2044 } 2044 }
2045 2045
2046 void BrowserView::OnLoadCompleted() { 2046 void BrowserView::OnLoadCompleted() {
2047 #if defined(OS_WIN) && !defined(USE_AURA) 2047 #if defined(OS_WIN)
2048 DCHECK(!jumplist_); 2048 DCHECK(!jumplist_);
2049 jumplist_ = new JumpList(); 2049 jumplist_ = new JumpList();
2050 jumplist_->AddObserver(browser_->profile()); 2050 jumplist_->AddObserver(browser_->profile());
2051 #endif 2051 #endif
2052 } 2052 }
2053 2053
2054 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const { 2054 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const {
2055 return static_cast<BrowserViewLayout*>(GetLayoutManager()); 2055 return static_cast<BrowserViewLayout*>(GetLayoutManager());
2056 } 2056 }
2057 2057
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 case APPCOMMAND_SPELL_CHECK: 2357 case APPCOMMAND_SPELL_CHECK:
2358 default: return -1; 2358 default: return -1;
2359 } 2359 }
2360 #else 2360 #else
2361 // App commands are Windows-specific so there's nothing to do here. 2361 // App commands are Windows-specific so there's nothing to do here.
2362 return -1; 2362 return -1;
2363 #endif 2363 #endif
2364 } 2364 }
2365 2365
2366 void BrowserView::InitHangMonitor() { 2366 void BrowserView::InitHangMonitor() {
2367 #if defined(OS_WIN) && !defined(USE_AURA) 2367 #if defined(OS_WIN)
2368 PrefService* pref_service = g_browser_process->local_state(); 2368 PrefService* pref_service = g_browser_process->local_state();
2369 if (!pref_service) 2369 if (!pref_service)
2370 return; 2370 return;
2371 2371
2372 int plugin_message_response_timeout = 2372 int plugin_message_response_timeout =
2373 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout); 2373 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout);
2374 int hung_plugin_detect_freq = 2374 int hung_plugin_detect_freq =
2375 pref_service->GetInteger(prefs::kHungPluginDetectFrequency); 2375 pref_service->GetInteger(prefs::kHungPluginDetectFrequency);
2376 #if defined(USE_AURA)
2377 HWND window = GetWidget()->GetNativeView()->GetDispatcher()->host()->
2378 GetAcceleratedWidget();
2379 #else
2380 HWND window = GetWidget()->GetNativeView();
2381 #endif
2376 if ((hung_plugin_detect_freq > 0) && 2382 if ((hung_plugin_detect_freq > 0) &&
2377 hung_window_detector_.Initialize(GetWidget()->GetNativeView(), 2383 hung_window_detector_.Initialize(window,
2378 plugin_message_response_timeout)) { 2384 plugin_message_response_timeout)) {
2379 ticker_.set_tick_interval(hung_plugin_detect_freq); 2385 ticker_.set_tick_interval(hung_plugin_detect_freq);
2380 ticker_.RegisterTickHandler(&hung_window_detector_); 2386 ticker_.RegisterTickHandler(&hung_window_detector_);
2381 ticker_.Start(); 2387 ticker_.Start();
2382 2388
2383 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout, 2389 pref_service->SetInteger(prefs::kPluginMessageResponseTimeout,
2384 plugin_message_response_timeout); 2390 plugin_message_response_timeout);
2385 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, 2391 pref_service->SetInteger(prefs::kHungPluginDetectFrequency,
2386 hung_plugin_detect_freq); 2392 hung_plugin_detect_freq);
2387 } 2393 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2612 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2607 gfx::Point icon_bottom( 2613 gfx::Point icon_bottom(
2608 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2614 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2609 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2615 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2610 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2616 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2611 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2617 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2612 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2618 top_arrow_height = infobar_top.y() - icon_bottom.y();
2613 } 2619 }
2614 return top_arrow_height; 2620 return top_arrow_height;
2615 } 2621 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698