OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compact_nav/compact_location_bar_view_host.h" | 5 #include "chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } | 471 } |
472 | 472 |
473 void CompactLocationBarViewHost::StartAutoHideTimer() { | 473 void CompactLocationBarViewHost::StartAutoHideTimer() { |
474 if (!IsVisible() || HasFocus()) | 474 if (!IsVisible() || HasFocus()) |
475 return; | 475 return; |
476 | 476 |
477 if (auto_hide_timer_->IsRunning()) { | 477 if (auto_hide_timer_->IsRunning()) { |
478 // Restart the timer. | 478 // Restart the timer. |
479 auto_hide_timer_->Reset(); | 479 auto_hide_timer_->Reset(); |
480 } else { | 480 } else { |
481 auto_hide_timer_->Start(FROM_HERE, | 481 auto_hide_timer_->Start(base::TimeDelta::FromSeconds(kHideTimeoutInSeconds), |
482 base::TimeDelta::FromSeconds(kHideTimeoutInSeconds), | |
483 this, &CompactLocationBarViewHost::HideCallback); | 482 this, &CompactLocationBarViewHost::HideCallback); |
484 } | 483 } |
485 } | 484 } |
486 | 485 |
487 void CompactLocationBarViewHost::CancelAutoHideTimer() { | 486 void CompactLocationBarViewHost::CancelAutoHideTimer() { |
488 auto_hide_timer_->Stop(); | 487 auto_hide_timer_->Stop(); |
489 } | 488 } |
490 | 489 |
491 void CompactLocationBarViewHost::SetEnabled(bool enabled) { | 490 void CompactLocationBarViewHost::SetEnabled(bool enabled) { |
492 if (enabled && !is_observing_) { | 491 if (enabled && !is_observing_) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { | 527 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { |
529 return current_tab_model_index_ == index; | 528 return current_tab_model_index_ == index; |
530 } | 529 } |
531 | 530 |
532 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { | 531 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { |
533 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); | 532 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); |
534 return tab_strip_model->ContainsIndex(current_tab_model_index_) && | 533 return tab_strip_model->ContainsIndex(current_tab_model_index_) && |
535 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> | 534 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> |
536 tab_contents() == contents; | 535 tab_contents() == contents; |
537 } | 536 } |
OLD | NEW |