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(base::TimeDelta::FromSeconds(kHideTimeoutInSeconds), | 481 auto_hide_timer_->Start(FROM_HERE, |
| 482 base::TimeDelta::FromSeconds(kHideTimeoutInSeconds), |
482 this, &CompactLocationBarViewHost::HideCallback); | 483 this, &CompactLocationBarViewHost::HideCallback); |
483 } | 484 } |
484 } | 485 } |
485 | 486 |
486 void CompactLocationBarViewHost::CancelAutoHideTimer() { | 487 void CompactLocationBarViewHost::CancelAutoHideTimer() { |
487 auto_hide_timer_->Stop(); | 488 auto_hide_timer_->Stop(); |
488 } | 489 } |
489 | 490 |
490 void CompactLocationBarViewHost::SetEnabled(bool enabled) { | 491 void CompactLocationBarViewHost::SetEnabled(bool enabled) { |
491 if (enabled && !is_observing_) { | 492 if (enabled && !is_observing_) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { | 528 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { |
528 return current_tab_model_index_ == index; | 529 return current_tab_model_index_ == index; |
529 } | 530 } |
530 | 531 |
531 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { | 532 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { |
532 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); | 533 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); |
533 return tab_strip_model->ContainsIndex(current_tab_model_index_) && | 534 return tab_strip_model->ContainsIndex(current_tab_model_index_) && |
534 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> | 535 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> |
535 tab_contents() == contents; | 536 tab_contents() == contents; |
536 } | 537 } |
OLD | NEW |