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/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); | 267 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); |
268 content_setting_views_.push_back(content_blocked_view); | 268 content_setting_views_.push_back(content_blocked_view); |
269 AddChildView(content_blocked_view); | 269 AddChildView(content_blocked_view); |
270 content_blocked_view->SetVisible(false); | 270 content_blocked_view->SetVisible(false); |
271 } | 271 } |
272 | 272 |
273 zoom_view_ = new ZoomView(model_); | 273 zoom_view_ = new ZoomView(model_); |
274 AddChildView(zoom_view_); | 274 AddChildView(zoom_view_); |
275 | 275 |
276 if (extensions::switch_utils::IsActionBoxEnabled()) { | 276 if (extensions::switch_utils::IsActionBoxEnabled()) { |
277 action_box_button_view_ = new ActionBoxButtonView( | 277 action_box_button_view_ = new ActionBoxButtonView(profile_, this); |
278 extensions::ExtensionSystem::Get(profile_)->extension_service()); | |
279 AddChildView(action_box_button_view_); | 278 AddChildView(action_box_button_view_); |
280 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 279 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
281 // Note: condition above means that the star and ChromeToMobile icons are | 280 // Note: condition above means that the star and ChromeToMobile icons are |
282 // hidden in popups and in the app launcher. | 281 // hidden in popups and in the app launcher. |
283 star_view_ = new StarView(command_updater_); | 282 star_view_ = new StarView(command_updater_); |
284 AddChildView(star_view_); | 283 AddChildView(star_view_); |
285 star_view_->SetVisible(true); | 284 star_view_->SetVisible(true); |
286 | 285 |
287 // Also disable Chrome To Mobile for off-the-record and non-synced profiles, | 286 // Also disable Chrome To Mobile for off-the-record and non-synced profiles, |
288 // or if the feature is disabled by a command line flag or chrome://flags. | 287 // or if the feature is disabled by a command line flag or chrome://flags. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 i != page_action_views_.end(); ++i) { | 488 i != page_action_views_.end(); ++i) { |
490 if ((*i)->image_view()->page_action() == page_action) | 489 if ((*i)->image_view()->page_action() == page_action) |
491 return *i; | 490 return *i; |
492 } | 491 } |
493 return NULL; | 492 return NULL; |
494 } | 493 } |
495 | 494 |
496 void LocationBarView::SetStarToggled(bool on) { | 495 void LocationBarView::SetStarToggled(bool on) { |
497 if (star_view_) | 496 if (star_view_) |
498 star_view_->SetToggled(on); | 497 star_view_->SetToggled(on); |
| 498 if (action_box_button_view_) |
| 499 action_box_button_view_->SetBookmarkState(on); |
499 } | 500 } |
500 | 501 |
501 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 502 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
502 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); | 503 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); |
503 } | 504 } |
504 | 505 |
505 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { | 506 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { |
506 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); | 507 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); |
507 } | 508 } |
508 | 509 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 } | 1054 } |
1054 | 1055 |
1055 InstantController* LocationBarView::GetInstant() { | 1056 InstantController* LocationBarView::GetInstant() { |
1056 return delegate_->GetInstant(); | 1057 return delegate_->GetInstant(); |
1057 } | 1058 } |
1058 | 1059 |
1059 TabContents* LocationBarView::GetTabContents() const { | 1060 TabContents* LocationBarView::GetTabContents() const { |
1060 return delegate_->GetTabContents(); | 1061 return delegate_->GetTabContents(); |
1061 } | 1062 } |
1062 | 1063 |
| 1064 Browser* LocationBarView::GetBrowser() const { |
| 1065 return GetBrowserFromDelegate(delegate_); |
| 1066 } |
| 1067 |
1063 int LocationBarView::AvailableWidth(int location_bar_width) { | 1068 int LocationBarView::AvailableWidth(int location_bar_width) { |
1064 return location_bar_width - location_entry_->TextWidth(); | 1069 return location_bar_width - location_entry_->TextWidth(); |
1065 } | 1070 } |
1066 | 1071 |
1067 void LocationBarView::LayoutView(views::View* view, | 1072 void LocationBarView::LayoutView(views::View* view, |
1068 int padding, | 1073 int padding, |
1069 int available_width, | 1074 int available_width, |
1070 bool leading, | 1075 bool leading, |
1071 gfx::Rect* bounds) { | 1076 gfx::Rect* bounds) { |
1072 DCHECK(view && bounds); | 1077 DCHECK(view && bounds); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 } | 1496 } |
1492 | 1497 |
1493 void LocationBarView::CleanupFadeAnimation() { | 1498 void LocationBarView::CleanupFadeAnimation() { |
1494 // Since we're no longer animating we don't need our layer. | 1499 // Since we're no longer animating we don't need our layer. |
1495 SetPaintToLayer(false); | 1500 SetPaintToLayer(false); |
1496 // Bubble labels don't need a transparent background anymore. | 1501 // Bubble labels don't need a transparent background anymore. |
1497 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1502 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1498 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1503 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1499 } | 1504 } |
1500 #endif // USE_AURA | 1505 #endif // USE_AURA |
OLD | NEW |