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 #include "chrome/browser/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 | 373 |
374 WebContents* ToolbarView::GetWebContents() const { | 374 WebContents* ToolbarView::GetWebContents() const { |
375 return browser_->tab_strip_model()->GetActiveWebContents(); | 375 return browser_->tab_strip_model()->GetActiveWebContents(); |
376 } | 376 } |
377 | 377 |
378 InstantController* ToolbarView::GetInstant() { | 378 InstantController* ToolbarView::GetInstant() { |
379 return browser_->instant_controller() ? | 379 return browser_->instant_controller() ? |
380 browser_->instant_controller()->instant() : NULL; | 380 browser_->instant_controller()->instant() : NULL; |
381 } | 381 } |
382 | 382 |
383 void ToolbarView::GetOmniboxPopupPositioningInfo( | |
Peter Kasting
2013/06/06 18:52:16
It seems like LocationBarView could implement this
Peter Kasting
2013/06/06 21:01:11
You didn't do this.
| |
384 gfx::Point* top_left_screen_coord, | |
385 int* popup_width, | |
386 int* left_margin, | |
387 int* right_margin) { | |
388 gfx::Rect location_bar_bounds(location_bar_->GetContentsBounds()); | |
389 const views::Border* border = location_bar_->border(); | |
390 if (border) { | |
Peter Kasting
2013/06/06 18:52:16
When is this true?
brettw
2013/06/06 20:46:49
I have no idea. This code is just moved from Omnib
Peter Kasting
2013/06/06 21:01:11
I tracked this down. This was added for the app l
| |
391 // Adjust for the border so that the bubble and location bar borders are | |
392 // aligned. | |
393 gfx::Insets insets = border->GetInsets(); | |
394 location_bar_bounds.Inset(insets.left(), 0, insets.right(), 0); | |
395 } else { | |
396 // The normal location bar is drawn using a background graphic that includes | |
397 // the border, so we inset by enough to make the edges line up, and the | |
398 // bubble appear at the same height as the Star bubble. | |
399 location_bar_bounds.Inset(LocationBarView::kNormalHorizontalEdgeThickness, | |
Peter Kasting
2013/06/06 18:52:16
Note: You'll need to update this for recent change
| |
400 0); | |
401 } | |
402 | |
403 *top_left_screen_coord = gfx::Point(0, height()); | |
404 views::View::ConvertPointToScreen(this, top_left_screen_coord); | |
405 *popup_width = width(); | |
406 | |
407 gfx::Point location_bar_in_toolbar(location_bar_bounds.origin()); | |
408 views::View::ConvertPointToTarget(location_bar_, this, | |
409 &location_bar_in_toolbar); | |
410 *left_margin = location_bar_in_toolbar.x(); | |
411 *right_margin = *popup_width - *left_margin - location_bar_bounds.width(); | |
412 } | |
413 | |
383 ContentSettingBubbleModelDelegate* | 414 ContentSettingBubbleModelDelegate* |
384 ToolbarView::GetContentSettingBubbleModelDelegate() { | 415 ToolbarView::GetContentSettingBubbleModelDelegate() { |
385 return browser_->content_setting_bubble_model_delegate(); | 416 return browser_->content_setting_bubble_model_delegate(); |
386 } | 417 } |
387 | 418 |
388 void ToolbarView::ShowWebsiteSettings(content::WebContents* web_contents, | 419 void ToolbarView::ShowWebsiteSettings(content::WebContents* web_contents, |
389 const GURL& url, | 420 const GURL& url, |
390 const content::SSLStatus& ssl, | 421 const content::SSLStatus& ssl, |
391 bool show_history) { | 422 bool show_history) { |
392 chrome::ShowWebsiteSettings(browser_, web_contents, url, ssl, show_history); | 423 chrome::ShowWebsiteSettings(browser_, web_contents, url, ssl, show_history); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 | 840 |
810 void ToolbarView::OnShowHomeButtonChanged() { | 841 void ToolbarView::OnShowHomeButtonChanged() { |
811 Layout(); | 842 Layout(); |
812 SchedulePaint(); | 843 SchedulePaint(); |
813 } | 844 } |
814 | 845 |
815 int ToolbarView::content_shadow_height() const { | 846 int ToolbarView::content_shadow_height() const { |
816 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 847 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
817 kContentShadowHeightAsh : kContentShadowHeight; | 848 kContentShadowHeightAsh : kContentShadowHeight; |
818 } | 849 } |
OLD | NEW |