OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 [field_ updateMouseTracking]; | 443 [field_ updateMouseTracking]; |
444 [field_ resetFieldEditorFrameIfNeeded]; | 444 [field_ resetFieldEditorFrameIfNeeded]; |
445 [field_ setNeedsDisplay:YES]; | 445 [field_ setNeedsDisplay:YES]; |
446 } | 446 } |
447 | 447 |
448 // TODO(shess): This function should over time grow to closely match | 448 // TODO(shess): This function should over time grow to closely match |
449 // the views Layout() function. | 449 // the views Layout() function. |
450 void LocationBarViewMac::Layout() { | 450 void LocationBarViewMac::Layout() { |
451 AutocompleteTextFieldCell* cell = [field_ cell]; | 451 AutocompleteTextFieldCell* cell = [field_ cell]; |
452 | 452 |
453 // Reset the left-hand decorations. | 453 // Reset the leading decorations. |
454 // TODO(shess): Shortly, this code will live somewhere else, like in | 454 // TODO(shess): Shortly, this code will live somewhere else, like in |
455 // the constructor. I am still wrestling with how best to deal with | 455 // the constructor. I am still wrestling with how best to deal with |
456 // right-hand decorations, which are not a static set. | 456 // right-hand decorations, which are not a static set. |
457 [cell clearDecorations]; | 457 [cell clearDecorations]; |
458 [cell addLeftDecoration:location_icon_decoration_.get()]; | 458 [cell addLeadingDecoration:location_icon_decoration_.get()]; |
459 [cell addLeftDecoration:selected_keyword_decoration_.get()]; | 459 [cell addLeadingDecoration:selected_keyword_decoration_.get()]; |
460 [cell addLeftDecoration:security_state_bubble_decoration_.get()]; | 460 [cell addLeadingDecoration:security_state_bubble_decoration_.get()]; |
461 [cell addRightDecoration:star_decoration_.get()]; | 461 [cell addTrailingDecoration:star_decoration_.get()]; |
462 [cell addRightDecoration:translate_decoration_.get()]; | 462 [cell addTrailingDecoration:translate_decoration_.get()]; |
463 [cell addRightDecoration:zoom_decoration_.get()]; | 463 [cell addTrailingDecoration:zoom_decoration_.get()]; |
464 [cell addRightDecoration:save_credit_card_decoration_.get()]; | 464 [cell addTrailingDecoration:save_credit_card_decoration_.get()]; |
465 [cell addRightDecoration:manage_passwords_decoration_.get()]; | 465 [cell addTrailingDecoration:manage_passwords_decoration_.get()]; |
466 | 466 |
467 // Note that display order is right to left. | 467 // Note that display order is front to back. |
468 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 468 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
469 [cell addRightDecoration:page_action_decorations_[i]]; | 469 [cell addTrailingDecoration:page_action_decorations_[i]]; |
470 } | 470 } |
471 | 471 |
472 for (ScopedVector<ContentSettingDecoration>::iterator i = | 472 for (ScopedVector<ContentSettingDecoration>::iterator i = |
473 content_setting_decorations_.begin(); | 473 content_setting_decorations_.begin(); |
474 i != content_setting_decorations_.end(); ++i) { | 474 i != content_setting_decorations_.end(); ++i) { |
475 [cell addRightDecoration:*i]; | 475 [cell addTrailingDecoration:*i]; |
476 } | 476 } |
477 | 477 |
478 [cell addRightDecoration:keyword_hint_decoration_.get()]; | 478 [cell addTrailingDecoration:keyword_hint_decoration_.get()]; |
479 | 479 |
480 // By default only the location icon is visible. | 480 // By default only the location icon is visible. |
481 location_icon_decoration_->SetVisible(true); | 481 location_icon_decoration_->SetVisible(true); |
482 selected_keyword_decoration_->SetVisible(false); | 482 selected_keyword_decoration_->SetVisible(false); |
483 keyword_hint_decoration_->SetVisible(false); | 483 keyword_hint_decoration_->SetVisible(false); |
484 security_state_bubble_decoration_->SetVisible(false); | 484 security_state_bubble_decoration_->SetVisible(false); |
485 | 485 |
486 // Get the keyword to use for keyword-search and hinting. | 486 // Get the keyword to use for keyword-search and hinting. |
487 const base::string16 keyword = omnibox_view_->model()->keyword(); | 487 const base::string16 keyword = omnibox_view_->model()->keyword(); |
488 base::string16 short_name; | 488 base::string16 short_name; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 OnDecorationsChanged(); | 972 OnDecorationsChanged(); |
973 } | 973 } |
974 | 974 |
975 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 975 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
976 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 976 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
977 std::vector<NSView*> views; | 977 std::vector<NSView*> views; |
978 for (auto* decoration : decorations) | 978 for (auto* decoration : decorations) |
979 views.push_back(decoration->GetAccessibilityView()); | 979 views.push_back(decoration->GetAccessibilityView()); |
980 return views; | 980 return views; |
981 } | 981 } |
OLD | NEW |