Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2207 | 2207 |
| 2208 // Check for updates to the desired size. | 2208 // Check for updates to the desired size. |
| 2209 if (bookmark_bar_view_->GetPreferredSize().height() != | 2209 if (bookmark_bar_view_->GetPreferredSize().height() != |
| 2210 bookmark_bar_view_->height()) | 2210 bookmark_bar_view_->height()) |
| 2211 needs_layout = true; | 2211 needs_layout = true; |
| 2212 | 2212 |
| 2213 return needs_layout; | 2213 return needs_layout; |
| 2214 } | 2214 } |
| 2215 | 2215 |
| 2216 void BrowserView::SetBookmarkBarParent(views::View* new_parent) { | 2216 void BrowserView::SetBookmarkBarParent(views::View* new_parent) { |
| 2217 // NOTE: The ink drops hosted by the |toolbar_| exceed the bounds of the | |
| 2218 // |toolbar_| so in order to have them visible above the |bookmark_bar_view_| | |
| 2219 // we need to explicitly add the |bookmark_bar_view_| as a child view at a | |
| 2220 // specific index because that is what determines z-order. | |
|
Peter Kasting
2016/03/31 22:22:57
Nit: How about this. TODO is optional, I don't kn
bruthig
2016/04/01 16:15:12
Modified slightly but done.
| |
| 2221 | |
| 2217 if (new_parent == this) { | 2222 if (new_parent == this) { |
| 2218 // Add it underneath |top_container_| or at the end if top container isn't | 2223 // BookmarkBarView is detached. |
| 2219 // found. | |
| 2220 int top_container_index = GetIndexOf(top_container_); | 2224 int top_container_index = GetIndexOf(top_container_); |
| 2221 if (top_container_index >= 0) | 2225 if (top_container_index >= 0) { |
| 2226 // |this| parents the |top_container_| and the |top_container_| parents | |
| 2227 // the |toolbar_| so we have to stack the |bookmark_bar_view_| behind the | |
| 2228 // |top_container_|. | |
|
Peter Kasting
2016/03/31 22:22:56
Nit: How about:
|top_container_| contains the too
bruthig
2016/04/01 16:15:12
Done.
| |
| 2222 AddChildViewAt(bookmark_bar_view_.get(), top_container_index); | 2229 AddChildViewAt(bookmark_bar_view_.get(), top_container_index); |
| 2223 else | 2230 } else { |
| 2231 // This is not an expected case and should only happen if | |
| 2232 // BrowserView::InitViews() has not been called. Presumably the |toolbar_| | |
| 2233 // is not visible so the z-order does not matter. | |
|
Peter Kasting
2016/03/31 22:22:57
Seems like if this is true we should remove this c
bruthig
2016/04/01 16:15:12
Done.
| |
| 2224 AddChildView(bookmark_bar_view_.get()); | 2234 AddChildView(bookmark_bar_view_.get()); |
| 2235 } | |
| 2236 } else if (new_parent == top_container_) { | |
| 2237 // BookmarkBarView is detached. | |
|
Peter Kasting
2016/03/31 22:22:57
Do you mean "attached"?
bruthig
2016/04/01 16:15:12
Done.
| |
| 2238 | |
| 2239 // The |top_container_| parents the |toolbar_| too so we stack the | |
| 2240 // |bookmark_bar_view_| first so it is behind the |toolbar_|. | |
|
Peter Kasting
2016/03/31 22:22:57
Nit: How about:
The toolbar is a child of |top_co
bruthig
2016/04/01 16:15:12
Done.
| |
| 2241 new_parent->AddChildViewAt(bookmark_bar_view_.get(), 0); | |
| 2225 } else if (new_parent) { | 2242 } else if (new_parent) { |
| 2226 // No special stacking is required for other parents. | 2243 // This is not an expected case so we will default to no special stacking. |
|
Peter Kasting
2016/03/31 22:22:57
Seems like if this is true we should remove this c
bruthig
2016/04/01 16:15:12
Done.
| |
| 2227 new_parent->AddChildView(bookmark_bar_view_.get()); | 2244 new_parent->AddChildView(bookmark_bar_view_.get()); |
| 2228 } else { | 2245 } else { |
| 2229 // Bookmark bar is being detached from all views because it is hidden. | 2246 // Bookmark bar is being detached from all views because it is hidden. |
| 2230 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get()); | 2247 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get()); |
| 2231 } | 2248 } |
| 2232 } | 2249 } |
| 2233 | 2250 |
| 2234 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { | 2251 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { |
| 2235 // TODO(beng): Remove this function once the interface between | 2252 // TODO(beng): Remove this function once the interface between |
| 2236 // InfoBarContainer, DownloadShelfView and WebContents and this | 2253 // InfoBarContainer, DownloadShelfView and WebContents and this |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2645 } | 2662 } |
| 2646 | 2663 |
| 2647 extensions::ActiveTabPermissionGranter* | 2664 extensions::ActiveTabPermissionGranter* |
| 2648 BrowserView::GetActiveTabPermissionGranter() { | 2665 BrowserView::GetActiveTabPermissionGranter() { |
| 2649 content::WebContents* web_contents = GetActiveWebContents(); | 2666 content::WebContents* web_contents = GetActiveWebContents(); |
| 2650 if (!web_contents) | 2667 if (!web_contents) |
| 2651 return nullptr; | 2668 return nullptr; |
| 2652 return extensions::TabHelper::FromWebContents(web_contents) | 2669 return extensions::TabHelper::FromWebContents(web_contents) |
| 2653 ->active_tab_permission_granter(); | 2670 ->active_tab_permission_granter(); |
| 2654 } | 2671 } |
| OLD | NEW |