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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return; | 397 return; |
398 RefreshPageActionDecorations(); | 398 RefreshPageActionDecorations(); |
399 Layout(); | 399 Layout(); |
400 | 400 |
401 PageActionDecoration* decoration = GetPageActionDecoration(page_action); | 401 PageActionDecoration* decoration = GetPageActionDecoration(page_action); |
402 DCHECK(decoration); | 402 DCHECK(decoration); |
403 if (!decoration) | 403 if (!decoration) |
404 return; | 404 return; |
405 | 405 |
406 decoration->set_preview_enabled(preview_enabled); | 406 decoration->set_preview_enabled(preview_enabled); |
407 decoration->UpdateVisibility(contents, GURL(toolbar_model_->GetText())); | 407 decoration->UpdateVisibility(contents, toolbar_model_->GetURL()); |
408 } | 408 } |
409 | 409 |
410 NSRect LocationBarViewMac::GetPageActionFrame(ExtensionAction* page_action) { | 410 NSRect LocationBarViewMac::GetPageActionFrame(ExtensionAction* page_action) { |
411 PageActionDecoration* decoration = GetPageActionDecoration(page_action); | 411 PageActionDecoration* decoration = GetPageActionDecoration(page_action); |
412 if (!decoration) | 412 if (!decoration) |
413 return NSZeroRect; | 413 return NSZeroRect; |
414 | 414 |
415 AutocompleteTextFieldCell* cell = [field_ cell]; | 415 AutocompleteTextFieldCell* cell = [field_ cell]; |
416 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; | 416 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; |
417 return frame; | 417 return frame; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 646 |
647 if (new_page_actions != page_actions_) { | 647 if (new_page_actions != page_actions_) { |
648 page_actions_.swap(new_page_actions); | 648 page_actions_.swap(new_page_actions); |
649 DeletePageActionDecorations(); | 649 DeletePageActionDecorations(); |
650 for (size_t i = 0; i < page_actions_.size(); ++i) { | 650 for (size_t i = 0; i < page_actions_.size(); ++i) { |
651 page_action_decorations_.push_back( | 651 page_action_decorations_.push_back( |
652 new PageActionDecoration(this, browser_, page_actions_[i])); | 652 new PageActionDecoration(this, browser_, page_actions_[i])); |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 GURL url = GURL(toolbar_model_->GetText()); | 656 GURL url = toolbar_model_->GetURL(); |
657 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 657 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
658 page_action_decorations_[i]->UpdateVisibility( | 658 page_action_decorations_[i]->UpdateVisibility( |
659 toolbar_model_->input_in_progress() ? | 659 toolbar_model_->input_in_progress() ? |
660 NULL : tab_contents->web_contents(), | 660 NULL : tab_contents->web_contents(), |
661 url); | 661 url); |
662 } | 662 } |
663 } | 663 } |
664 | 664 |
665 // TODO(shess): This function should over time grow to closely match | 665 // TODO(shess): This function should over time grow to closely match |
666 // the views Layout() function. | 666 // the views Layout() function. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 761 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
762 } | 762 } |
763 | 763 |
764 void LocationBarViewMac::UpdateZoomDecoration() { | 764 void LocationBarViewMac::UpdateZoomDecoration() { |
765 TabContents* tab_contents = GetTabContents(); | 765 TabContents* tab_contents = GetTabContents(); |
766 if (!tab_contents) | 766 if (!tab_contents) |
767 return; | 767 return; |
768 | 768 |
769 zoom_decoration_->Update(tab_contents->zoom_controller()); | 769 zoom_decoration_->Update(tab_contents->zoom_controller()); |
770 } | 770 } |
OLD | NEW |