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/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 | 2127 |
2128 if (devtools) { | 2128 if (devtools) { |
2129 devtools_web_view_->SetVisible(true); | 2129 devtools_web_view_->SetVisible(true); |
2130 GetContentsLayoutManager()->SetContentsResizingStrategy(strategy); | 2130 GetContentsLayoutManager()->SetContentsResizingStrategy(strategy); |
2131 } else { | 2131 } else { |
2132 devtools_web_view_->SetVisible(false); | 2132 devtools_web_view_->SetVisible(false); |
2133 GetContentsLayoutManager()->SetContentsResizingStrategy( | 2133 GetContentsLayoutManager()->SetContentsResizingStrategy( |
2134 DevToolsContentsResizingStrategy()); | 2134 DevToolsContentsResizingStrategy()); |
2135 } | 2135 } |
2136 contents_container_->Layout(); | 2136 contents_container_->Layout(); |
| 2137 |
| 2138 if (devtools) { |
| 2139 // When strategy.hide_inspected_contents() returns true, we are hiding |
| 2140 // contents_web_view_ behind the devtools_web_view_. Otherwise, |
| 2141 // contents_web_view_ should be right above the devtools_web_view_. |
| 2142 int devtools_index = contents_container_->GetIndexOf(devtools_web_view_); |
| 2143 int contents_index = contents_container_->GetIndexOf(contents_web_view_); |
| 2144 bool devtools_is_on_top = devtools_index > contents_index; |
| 2145 if (strategy.hide_inspected_contents() != devtools_is_on_top) |
| 2146 contents_container_->ReorderChildView(contents_web_view_, devtools_index); |
| 2147 } |
2137 } | 2148 } |
2138 | 2149 |
2139 void BrowserView::UpdateUIForContents(WebContents* contents) { | 2150 void BrowserView::UpdateUIForContents(WebContents* contents) { |
2140 bool needs_layout = MaybeShowBookmarkBar(contents); | 2151 bool needs_layout = MaybeShowBookmarkBar(contents); |
2141 // TODO(jamescook): This function always returns true. Remove it and figure | 2152 // TODO(jamescook): This function always returns true. Remove it and figure |
2142 // out when layout is actually required. | 2153 // out when layout is actually required. |
2143 needs_layout |= MaybeShowInfoBar(contents); | 2154 needs_layout |= MaybeShowInfoBar(contents); |
2144 if (needs_layout) | 2155 if (needs_layout) |
2145 Layout(); | 2156 Layout(); |
2146 } | 2157 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2547 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2537 gfx::Point icon_bottom( | 2548 gfx::Point icon_bottom( |
2538 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2549 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2539 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2550 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2540 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2551 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2541 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2552 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2542 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2553 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2543 } | 2554 } |
2544 return top_arrow_height; | 2555 return top_arrow_height; |
2545 } | 2556 } |
OLD | NEW |