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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 #include "ui/compositor/scoped_layer_animation_settings.h" | 95 #include "ui/compositor/scoped_layer_animation_settings.h" |
96 #endif | 96 #endif |
97 | 97 |
98 using content::WebContents; | 98 using content::WebContents; |
99 using views::View; | 99 using views::View; |
100 | 100 |
101 namespace { | 101 namespace { |
102 | 102 |
103 Browser* GetBrowserFromDelegate(LocationBarView::Delegate* delegate) { | 103 Browser* GetBrowserFromDelegate(LocationBarView::Delegate* delegate) { |
104 WebContents* contents = delegate->GetWebContents(); | 104 WebContents* contents = delegate->GetWebContents(); |
105 return browser::FindBrowserWithWebContents(contents); | 105 return chrome::FindBrowserWithWebContents(contents); |
106 } | 106 } |
107 | 107 |
108 // Height of the location bar's round corner region. | 108 // Height of the location bar's round corner region. |
109 const int kBorderRoundCornerHeight = 5; | 109 const int kBorderRoundCornerHeight = 5; |
110 // Width of location bar's round corner region. | 110 // Width of location bar's round corner region. |
111 const int kBorderRoundCornerWidth = 4; | 111 const int kBorderRoundCornerWidth = 4; |
112 // Radius of the round corners inside the location bar. | 112 // Radius of the round corners inside the location bar. |
113 const int kBorderCornerRadius = 2; | 113 const int kBorderCornerRadius = 2; |
114 | 114 |
115 const int kDesktopItemPadding = 3; | 115 const int kDesktopItemPadding = 3; |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 // inserted in left-to-right order for accessibility. | 1219 // inserted in left-to-right order for accessibility. |
1220 for (int i = page_actions_.size() - 1; i >= 0; --i) { | 1220 for (int i = page_actions_.size() - 1; i >= 0; --i) { |
1221 page_action_views_[i] = new PageActionWithBadgeView( | 1221 page_action_views_[i] = new PageActionWithBadgeView( |
1222 delegate_->CreatePageActionImageView(this, page_actions_[i])); | 1222 delegate_->CreatePageActionImageView(this, page_actions_[i])); |
1223 page_action_views_[i]->SetVisible(false); | 1223 page_action_views_[i]->SetVisible(false); |
1224 AddChildViewAt(page_action_views_[i], GetIndexOf(right_anchor)); | 1224 AddChildViewAt(page_action_views_[i], GetIndexOf(right_anchor)); |
1225 } | 1225 } |
1226 } | 1226 } |
1227 | 1227 |
1228 if (!page_action_views_.empty() && contents) { | 1228 if (!page_action_views_.empty() && contents) { |
1229 Browser* browser = browser::FindBrowserWithWebContents(contents); | 1229 Browser* browser = chrome::FindBrowserWithWebContents(contents); |
1230 GURL url = chrome::GetActiveWebContents(browser)->GetURL(); | 1230 GURL url = chrome::GetActiveWebContents(browser)->GetURL(); |
1231 | 1231 |
1232 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 1232 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
1233 i != page_action_views_.end(); ++i) { | 1233 i != page_action_views_.end(); ++i) { |
1234 (*i)->UpdateVisibility(model_->GetInputInProgress() ? NULL : contents, | 1234 (*i)->UpdateVisibility(model_->GetInputInProgress() ? NULL : contents, |
1235 url); | 1235 url); |
1236 | 1236 |
1237 // Check if the visibility of the action changed and notify if it did. | 1237 // Check if the visibility of the action changed and notify if it did. |
1238 ExtensionAction* action = (*i)->image_view()->page_action(); | 1238 ExtensionAction* action = (*i)->image_view()->page_action(); |
1239 if (old_visibility.find(action) == old_visibility.end() || | 1239 if (old_visibility.find(action) == old_visibility.end() || |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1571 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
1572 int total_height = | 1572 int total_height = |
1573 use_preferred_size ? GetPreferredSize().height() : height(); | 1573 use_preferred_size ? GetPreferredSize().height() : height(); |
1574 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); | 1574 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); |
1575 } | 1575 } |
1576 | 1576 |
1577 bool LocationBarView::HasValidSuggestText() const { | 1577 bool LocationBarView::HasValidSuggestText() const { |
1578 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1578 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1579 !suggested_text_view_->text().empty(); | 1579 !suggested_text_view_->text().empty(); |
1580 } | 1580 } |
OLD | NEW |