| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 keyword_hint_view_->SetFont(font_); | 263 keyword_hint_view_->SetFont(font_); |
| 264 | 264 |
| 265 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 265 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 266 ContentSettingImageView* content_blocked_view = | 266 ContentSettingImageView* content_blocked_view = |
| 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 // Create the zoom view. At this point, |delegate_| has not yet been assigned |
| 274 // a TabContents, so calling GetTabContents() will just return NULL. Thus, |
| 275 // |delegate_| itself is passed here, where it can be queried at a later time |
| 276 // for the appropriate TabContents. |
| 277 zoom_view_ = new ZoomView(model_, delegate_); |
| 274 AddChildView(zoom_view_); | 278 AddChildView(zoom_view_); |
| 275 | 279 |
| 276 if (extensions::switch_utils::IsActionBoxEnabled()) { | 280 if (extensions::switch_utils::IsActionBoxEnabled()) { |
| 277 action_box_button_view_ = new ActionBoxButtonView( | 281 action_box_button_view_ = new ActionBoxButtonView( |
| 278 extensions::ExtensionSystem::Get(profile_)->extension_service()); | 282 extensions::ExtensionSystem::Get(profile_)->extension_service()); |
| 279 AddChildView(action_box_button_view_); | 283 AddChildView(action_box_button_view_); |
| 280 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 284 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
| 281 // Note: condition above means that the star and ChromeToMobile icons are | 285 // Note: condition above means that the star and ChromeToMobile icons are |
| 282 // hidden in popups and in the app launcher. | 286 // hidden in popups and in the app launcher. |
| 283 star_view_ = new StarView(command_updater_); | 287 star_view_ = new StarView(command_updater_); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 512 |
| 509 void LocationBarView::SetZoomIconState( | 513 void LocationBarView::SetZoomIconState( |
| 510 ZoomController::ZoomIconState zoom_icon_state) { | 514 ZoomController::ZoomIconState zoom_icon_state) { |
| 511 zoom_view_->SetZoomIconState(zoom_icon_state); | 515 zoom_view_->SetZoomIconState(zoom_icon_state); |
| 512 | 516 |
| 513 Layout(); | 517 Layout(); |
| 514 SchedulePaint(); | 518 SchedulePaint(); |
| 515 } | 519 } |
| 516 | 520 |
| 517 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 521 void LocationBarView::ShowZoomBubble(int zoom_percent) { |
| 518 ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true); | 522 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); |
| 519 } | 523 } |
| 520 | 524 |
| 521 void LocationBarView::ShowChromeToMobileBubble() { | 525 void LocationBarView::ShowChromeToMobileBubble() { |
| 522 Browser* browser = GetBrowserFromDelegate(delegate_); | 526 Browser* browser = GetBrowserFromDelegate(delegate_); |
| 523 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 527 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
| 524 } | 528 } |
| 525 | 529 |
| 526 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 530 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
| 527 gfx::Point origin(location_entry_view_->bounds().origin()); | 531 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 528 // If the UI layout is RTL, the coordinate system is not transformed and | 532 // If the UI layout is RTL, the coordinate system is not transformed and |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 } | 1495 } |
| 1492 | 1496 |
| 1493 void LocationBarView::CleanupFadeAnimation() { | 1497 void LocationBarView::CleanupFadeAnimation() { |
| 1494 // Since we're no longer animating we don't need our layer. | 1498 // Since we're no longer animating we don't need our layer. |
| 1495 SetPaintToLayer(false); | 1499 SetPaintToLayer(false); |
| 1496 // Bubble labels don't need a transparent background anymore. | 1500 // Bubble labels don't need a transparent background anymore. |
| 1497 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1501 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1498 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1502 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1499 } | 1503 } |
| 1500 #endif // USE_AURA | 1504 #endif // USE_AURA |
| OLD | NEW |