| 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 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 [field_ updateMouseTracking]; | 403 [field_ updateMouseTracking]; |
| 404 [field_ resetFieldEditorFrameIfNeeded]; | 404 [field_ resetFieldEditorFrameIfNeeded]; |
| 405 [field_ setNeedsDisplay:YES]; | 405 [field_ setNeedsDisplay:YES]; |
| 406 } | 406 } |
| 407 | 407 |
| 408 // TODO(shess): This function should over time grow to closely match | 408 // TODO(shess): This function should over time grow to closely match |
| 409 // the views Layout() function. | 409 // the views Layout() function. |
| 410 void LocationBarViewMac::Layout() { | 410 void LocationBarViewMac::Layout() { |
| 411 AutocompleteTextFieldCell* cell = [field_ cell]; | 411 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 412 | 412 |
| 413 // Reset the left-hand decorations. | 413 // Reset the leading decorations. |
| 414 // TODO(shess): Shortly, this code will live somewhere else, like in | 414 // TODO(shess): Shortly, this code will live somewhere else, like in |
| 415 // the constructor. I am still wrestling with how best to deal with | 415 // the constructor. I am still wrestling with how best to deal with |
| 416 // right-hand decorations, which are not a static set. | 416 // right-hand decorations, which are not a static set. |
| 417 [cell clearDecorations]; | 417 [cell clearDecorations]; |
| 418 [cell addLeftDecoration:location_icon_decoration_.get()]; | 418 [cell addLeadingDecoration:location_icon_decoration_.get()]; |
| 419 [cell addLeftDecoration:selected_keyword_decoration_.get()]; | 419 [cell addLeadingDecoration:selected_keyword_decoration_.get()]; |
| 420 [cell addLeftDecoration:security_state_bubble_decoration_.get()]; | 420 [cell addLeadingDecoration:security_state_bubble_decoration_.get()]; |
| 421 [cell addRightDecoration:star_decoration_.get()]; | 421 [cell addTrailingDecoration:star_decoration_.get()]; |
| 422 [cell addRightDecoration:translate_decoration_.get()]; | 422 [cell addTrailingDecoration:translate_decoration_.get()]; |
| 423 [cell addRightDecoration:zoom_decoration_.get()]; | 423 [cell addTrailingDecoration:zoom_decoration_.get()]; |
| 424 [cell addRightDecoration:save_credit_card_decoration_.get()]; | 424 [cell addTrailingDecoration:save_credit_card_decoration_.get()]; |
| 425 [cell addRightDecoration:manage_passwords_decoration_.get()]; | 425 [cell addTrailingDecoration:manage_passwords_decoration_.get()]; |
| 426 | 426 |
| 427 // Note that display order is right to left. | 427 // Note that display order is front to back. |
| 428 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 428 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| 429 [cell addRightDecoration:page_action_decorations_[i]]; | 429 [cell addTrailingDecoration:page_action_decorations_[i]]; |
| 430 } | 430 } |
| 431 | 431 |
| 432 for (ScopedVector<ContentSettingDecoration>::iterator i = | 432 for (ScopedVector<ContentSettingDecoration>::iterator i = |
| 433 content_setting_decorations_.begin(); | 433 content_setting_decorations_.begin(); |
| 434 i != content_setting_decorations_.end(); ++i) { | 434 i != content_setting_decorations_.end(); ++i) { |
| 435 [cell addRightDecoration:*i]; | 435 [cell addTrailingDecoration:*i]; |
| 436 } | 436 } |
| 437 | 437 |
| 438 [cell addRightDecoration:keyword_hint_decoration_.get()]; | 438 [cell addTrailingDecoration:keyword_hint_decoration_.get()]; |
| 439 | 439 |
| 440 // By default only the location icon is visible. | 440 // By default only the location icon is visible. |
| 441 location_icon_decoration_->SetVisible(true); | 441 location_icon_decoration_->SetVisible(true); |
| 442 selected_keyword_decoration_->SetVisible(false); | 442 selected_keyword_decoration_->SetVisible(false); |
| 443 keyword_hint_decoration_->SetVisible(false); | 443 keyword_hint_decoration_->SetVisible(false); |
| 444 security_state_bubble_decoration_->SetVisible(false); | 444 security_state_bubble_decoration_->SetVisible(false); |
| 445 | 445 |
| 446 // Get the keyword to use for keyword-search and hinting. | 446 // Get the keyword to use for keyword-search and hinting. |
| 447 const base::string16 keyword = omnibox_view_->model()->keyword(); | 447 const base::string16 keyword = omnibox_view_->model()->keyword(); |
| 448 base::string16 short_name; | 448 base::string16 short_name; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 OnDecorationsChanged(); | 921 OnDecorationsChanged(); |
| 922 } | 922 } |
| 923 | 923 |
| 924 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 924 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 925 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 925 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 926 std::vector<NSView*> views; | 926 std::vector<NSView*> views; |
| 927 for (auto* decoration : decorations) | 927 for (auto* decoration : decorations) |
| 928 views.push_back(decoration->GetAccessibilityView()); | 928 views.push_back(decoration->GetAccessibilityView()); |
| 929 return views; | 929 return views; |
| 930 } | 930 } |
| OLD | NEW |