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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 Source<NavigationController>(&tab_contents->controller())); | 342 Source<NavigationController>(&tab_contents->controller())); |
343 } | 343 } |
344 } else { | 344 } else { |
345 StartAutoHideTimer(); | 345 StartAutoHideTimer(); |
346 } | 346 } |
347 } | 347 } |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 void CompactLocationBarViewHost::ActiveTabClicked(int index) { | 351 void CompactLocationBarViewHost::ActiveTabClicked(int index) { |
| 352 // On active tab click, show the compact location bar and also select all the |
| 353 // contents for quick editing. |
352 UpdateOnTabChange(index, true); | 354 UpdateOnTabChange(index, true); |
| 355 GetCompactLocationBarView()->SetFocusAndSelection(true); |
353 } | 356 } |
354 | 357 |
355 //////////////////////////////////////////////////////////////////////////////// | 358 //////////////////////////////////////////////////////////////////////////////// |
356 // CompactLocationBarViewHost, NotificationObserver implementation: | 359 // CompactLocationBarViewHost, NotificationObserver implementation: |
357 | 360 |
358 void CompactLocationBarViewHost::Observe(NotificationType type, | 361 void CompactLocationBarViewHost::Observe(NotificationType type, |
359 const NotificationSource& source, | 362 const NotificationSource& source, |
360 const NotificationDetails& details) { | 363 const NotificationDetails& details) { |
361 switch (type.value) { | 364 switch (type.value) { |
362 case NotificationType::LOAD_STOP: { | 365 case NotificationType::LOAD_STOP: { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { | 511 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { |
509 return current_tab_model_index_ == index; | 512 return current_tab_model_index_ == index; |
510 } | 513 } |
511 | 514 |
512 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { | 515 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { |
513 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); | 516 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); |
514 return tab_strip_model->ContainsIndex(current_tab_model_index_) && | 517 return tab_strip_model->ContainsIndex(current_tab_model_index_) && |
515 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> | 518 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> |
516 tab_contents() == contents; | 519 tab_contents() == contents; |
517 } | 520 } |
OLD | NEW |