Chromium Code Reviews| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 else | 522 else |
| 523 location_entry_->Update(); | 523 location_entry_->Update(); |
| 524 | 524 |
| 525 OnChanged(); | 525 OnChanged(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void LocationBarView::UpdateContentSettingsIcons() { | 528 void LocationBarView::UpdateContentSettingsIcons() { |
| 529 RefreshContentSettingViews(); | 529 RefreshContentSettingViews(); |
| 530 | 530 |
| 531 Layout(); | 531 Layout(); |
| 532 UpdatePostLayout(); | |
| 532 SchedulePaint(); | 533 SchedulePaint(); |
| 533 } | 534 } |
| 534 | 535 |
| 535 void LocationBarView::UpdatePageActions() { | 536 void LocationBarView::UpdatePageActions() { |
| 536 size_t count_before = page_action_views_.size(); | 537 size_t count_before = page_action_views_.size(); |
| 537 RefreshPageActionViews(); | 538 RefreshPageActionViews(); |
| 538 RefreshScriptBubble(); | 539 RefreshScriptBubble(); |
| 539 if (page_action_views_.size() != count_before) { | 540 if (page_action_views_.size() != count_before) { |
| 540 content::NotificationService::current()->Notify( | 541 content::NotificationService::current()->Notify( |
| 541 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, | 542 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 return (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) ? | 1128 return (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) ? |
| 1128 GetItemPadding() / 2 : 0; | 1129 GetItemPadding() / 2 : 0; |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 int LocationBarView::GetHorizontalEdgeThickness() const { | 1132 int LocationBarView::GetHorizontalEdgeThickness() const { |
| 1132 // In maximized popup mode, there isn't any edge. | 1133 // In maximized popup mode, there isn't any edge. |
| 1133 return (is_popup_mode_ && browser_ && browser_->window() && | 1134 return (is_popup_mode_ && browser_ && browser_->window() && |
| 1134 browser_->window()->IsMaximized()) ? 0 : vertical_edge_thickness(); | 1135 browser_->window()->IsMaximized()) ? 0 : vertical_edge_thickness(); |
| 1135 } | 1136 } |
| 1136 | 1137 |
| 1137 void LocationBarView::RefreshContentSettingViews() { | 1138 void LocationBarView::RefreshContentSettingViews() { |
|
Peter Kasting
2013/09/03 23:50:43
I realize you said that only one place can make th
npentrel
2013/09/04 09:55:36
In the other place where RefreshCOntentSettingView
npentrel
2013/09/04 11:27:31
Never mind, it is called. I added the call to Upda
| |
| 1138 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 1139 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 1139 i != content_setting_views_.end(); ++i) { | 1140 i != content_setting_views_.end(); ++i) { |
| 1140 (*i)->Update(GetToolbarModel()->input_in_progress() ? | 1141 (*i)->UpdatePreLayout(GetToolbarModel()->input_in_progress() ? |
| 1141 NULL : GetWebContents()); | 1142 NULL : GetWebContents()); |
| 1142 } | 1143 } |
| 1143 } | 1144 } |
| 1145 | |
| 1146 void LocationBarView::UpdatePostLayout() { | |
|
Peter Kasting
2013/09/03 23:50:43
I think calling this UpdatePostLayout() is somewha
npentrel
2013/09/04 09:55:36
Done.
| |
| 1147 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | |
| 1148 i != content_setting_views_.end(); ++i) { | |
| 1149 (*i)->UpdatePostLayout(GetToolbarModel()->input_in_progress() ? | |
| 1150 NULL : GetWebContents()); | |
| 1151 } | |
| 1152 } | |
| 1144 | 1153 |
| 1145 void LocationBarView::DeletePageActionViews() { | 1154 void LocationBarView::DeletePageActionViews() { |
| 1146 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 1155 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
| 1147 i != page_action_views_.end(); ++i) | 1156 i != page_action_views_.end(); ++i) |
| 1148 RemoveChildView(*i); | 1157 RemoveChildView(*i); |
| 1149 STLDeleteElements(&page_action_views_); | 1158 STLDeleteElements(&page_action_views_); |
| 1150 } | 1159 } |
| 1151 | 1160 |
| 1152 void LocationBarView::RefreshPageActionViews() { | 1161 void LocationBarView::RefreshPageActionViews() { |
| 1153 if (is_popup_mode_) | 1162 if (is_popup_mode_) |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1553 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1562 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 1554 int total_height = | 1563 int total_height = |
| 1555 use_preferred_size ? GetPreferredSize().height() : height(); | 1564 use_preferred_size ? GetPreferredSize().height() : height(); |
| 1556 return std::max(total_height - (vertical_edge_thickness() * 2), 0); | 1565 return std::max(total_height - (vertical_edge_thickness() * 2), 0); |
| 1557 } | 1566 } |
| 1558 | 1567 |
| 1559 bool LocationBarView::HasValidSuggestText() const { | 1568 bool LocationBarView::HasValidSuggestText() const { |
| 1560 return suggested_text_view_->visible() && | 1569 return suggested_text_view_->visible() && |
| 1561 !suggested_text_view_->size().IsEmpty(); | 1570 !suggested_text_view_->size().IsEmpty(); |
| 1562 } | 1571 } |
| OLD | NEW |