| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 const int kSearchButtonWidth = 56; | 421 const int kSearchButtonWidth = 56; |
| 422 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); | 422 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); |
| 423 search_button_->SetVisible(false); | 423 search_button_->SetVisible(false); |
| 424 AddChildView(search_button_); | 424 AddChildView(search_button_); |
| 425 | 425 |
| 426 content::Source<Profile> profile_source = content::Source<Profile>(profile()); | 426 content::Source<Profile> profile_source = content::Source<Profile>(profile()); |
| 427 registrar_.Add(this, | 427 registrar_.Add(this, |
| 428 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 428 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 429 profile_source); | 429 profile_source); |
| 430 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 430 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); |
| 431 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, profile_source); | 431 registrar_.Add(this, |
| 432 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 433 profile_source); |
| 432 | 434 |
| 433 // Initialize the location entry. We do this to avoid a black flash which is | 435 // Initialize the location entry. We do this to avoid a black flash which is |
| 434 // visible when the location entry has just been initialized. | 436 // visible when the location entry has just been initialized. |
| 435 Update(NULL); | 437 Update(NULL); |
| 436 } | 438 } |
| 437 | 439 |
| 438 bool LocationBarView::IsInitialized() const { | 440 bool LocationBarView::IsInitialized() const { |
| 439 return omnibox_view_ != NULL; | 441 return omnibox_view_ != NULL; |
| 440 } | 442 } |
| 441 | 443 |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 switch (type) { | 1340 switch (type) { |
| 1339 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | 1341 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
| 1340 // Only update if the updated action box was for the active tab contents. | 1342 // Only update if the updated action box was for the active tab contents. |
| 1341 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | 1343 WebContents* target_tab = content::Details<WebContents>(details).ptr(); |
| 1342 if (target_tab == GetWebContents()) | 1344 if (target_tab == GetWebContents()) |
| 1343 UpdatePageActions(); | 1345 UpdatePageActions(); |
| 1344 break; | 1346 break; |
| 1345 } | 1347 } |
| 1346 | 1348 |
| 1347 case chrome::NOTIFICATION_EXTENSION_LOADED: | 1349 case chrome::NOTIFICATION_EXTENSION_LOADED: |
| 1348 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 1350 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 1349 Update(NULL); | 1351 Update(NULL); |
| 1350 break; | 1352 break; |
| 1351 | 1353 |
| 1352 default: | 1354 default: |
| 1353 NOTREACHED() << "Unexpected notification."; | 1355 NOTREACHED() << "Unexpected notification."; |
| 1354 } | 1356 } |
| 1355 } | 1357 } |
| 1356 | 1358 |
| 1357 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1359 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1358 const SearchModel::State& new_state) { | 1360 const SearchModel::State& new_state) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 if (!browser) | 1550 if (!browser) |
| 1549 return; // Possible when browser is shutting down. | 1551 return; // Possible when browser is shutting down. |
| 1550 | 1552 |
| 1551 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); | 1553 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); |
| 1552 #endif | 1554 #endif |
| 1553 } | 1555 } |
| 1554 | 1556 |
| 1555 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { | 1557 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { |
| 1556 omnibox_view_->SetUserText(new_value, new_value, true); | 1558 omnibox_view_->SetUserText(new_value, new_value, true); |
| 1557 } | 1559 } |
| OLD | NEW |