| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (old_url.has_host() && new_url.host() == old_url.host() && | 345 if (old_url.has_host() && new_url.host() == old_url.host() && |
| 346 new_url.scheme() == old_url.scheme()) { | 346 new_url.scheme() == old_url.scheme()) { |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 Update(tab_contents, false); | 350 Update(tab_contents, false); |
| 351 if (was_not_visible) { | 351 if (was_not_visible) { |
| 352 if (tab_contents->is_loading()) { | 352 if (tab_contents->is_loading()) { |
| 353 // Register to NavigationController LOAD_STOP so that we can autohide | 353 // Register to NavigationController LOAD_STOP so that we can autohide |
| 354 // when loading is done. | 354 // when loading is done. |
| 355 if (!registrar_.IsRegistered(this, NotificationType::LOAD_STOP, | 355 if (!registrar_.IsRegistered(this, content::NOTIFICATION_LOAD_STOP, |
| 356 Source<NavigationController>(&tab_contents->controller()))) { | 356 Source<NavigationController>(&tab_contents->controller()))) { |
| 357 registrar_.Add(this, NotificationType::LOAD_STOP, | 357 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 358 Source<NavigationController>(&tab_contents->controller())); | 358 Source<NavigationController>(&tab_contents->controller())); |
| 359 } | 359 } |
| 360 } else { | 360 } else { |
| 361 StartAutoHideTimer(); | 361 StartAutoHideTimer(); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 void CompactLocationBarViewHost::ActiveTabClicked(int index) { | 367 void CompactLocationBarViewHost::ActiveTabClicked(int index) { |
| 368 // On active tab click, show the compact location bar and also select all the | 368 // On active tab click, show the compact location bar and also select all the |
| 369 // contents for quick editing. | 369 // contents for quick editing. |
| 370 UpdateOnTabChange(index, true); | 370 UpdateOnTabChange(index, true); |
| 371 GetCompactLocationBarView()->SetFocusAndSelection(true); | 371 GetCompactLocationBarView()->SetFocusAndSelection(true); |
| 372 } | 372 } |
| 373 | 373 |
| 374 //////////////////////////////////////////////////////////////////////////////// | 374 //////////////////////////////////////////////////////////////////////////////// |
| 375 // CompactLocationBarViewHost, NotificationObserver implementation: | 375 // CompactLocationBarViewHost, NotificationObserver implementation: |
| 376 | 376 |
| 377 void CompactLocationBarViewHost::Observe(NotificationType type, | 377 void CompactLocationBarViewHost::Observe(int type, |
| 378 const NotificationSource& source, | 378 const NotificationSource& source, |
| 379 const NotificationDetails& details) { | 379 const NotificationDetails& details) { |
| 380 switch (type.value) { | 380 switch (type) { |
| 381 case NotificationType::LOAD_STOP: { | 381 case content::NOTIFICATION_LOAD_STOP: { |
| 382 StartAutoHideTimer(); | 382 StartAutoHideTimer(); |
| 383 // This is one shot deal... | 383 // This is one shot deal... |
| 384 registrar_.Remove(this, NotificationType::LOAD_STOP, source); | 384 registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, source); |
| 385 break; | 385 break; |
| 386 } | 386 } |
| 387 default: | 387 default: |
| 388 NOTREACHED(); | 388 NOTREACHED(); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 //////////////////////////////////////////////////////////////////////////////// | 392 //////////////////////////////////////////////////////////////////////////////// |
| 393 // CompactLocationBarViewHost public: | 393 // CompactLocationBarViewHost public: |
| 394 | 394 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { | 527 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { |
| 528 return current_tab_model_index_ == index; | 528 return current_tab_model_index_ == index; |
| 529 } | 529 } |
| 530 | 530 |
| 531 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { | 531 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { |
| 532 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); | 532 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); |
| 533 return tab_strip_model->ContainsIndex(current_tab_model_index_) && | 533 return tab_strip_model->ContainsIndex(current_tab_model_index_) && |
| 534 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> | 534 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> |
| 535 tab_contents() == contents; | 535 tab_contents() == contents; |
| 536 } | 536 } |
| OLD | NEW |