Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2946813002: Bookmark disappear first when closing browser (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const { 2172 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const {
2173 return static_cast<BrowserViewLayout*>(GetLayoutManager()); 2173 return static_cast<BrowserViewLayout*>(GetLayoutManager());
2174 } 2174 }
2175 2175
2176 ContentsLayoutManager* BrowserView::GetContentsLayoutManager() const { 2176 ContentsLayoutManager* BrowserView::GetContentsLayoutManager() const {
2177 return static_cast<ContentsLayoutManager*>( 2177 return static_cast<ContentsLayoutManager*>(
2178 contents_container_->GetLayoutManager()); 2178 contents_container_->GetLayoutManager());
2179 } 2179 }
2180 2180
2181 bool BrowserView::MaybeShowBookmarkBar(WebContents* contents) { 2181 bool BrowserView::MaybeShowBookmarkBar(WebContents* contents) {
2182 bool show_bookmark_bar = contents && 2182 bool show_bookmark_bar = contents &&
sky 2017/06/20 16:35:06 I think the bug is here. We should show the bookma
weidongg 2017/06/20 19:51:50 Aha I see, so I could change it to: "bool show_boo
2183 browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR); 2183 browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR);
2184 if (!show_bookmark_bar && !bookmark_bar_view_.get()) 2184 if (!show_bookmark_bar && !bookmark_bar_view_.get())
2185 return false; 2185 return false;
2186 if (!bookmark_bar_view_.get()) { 2186 if (!bookmark_bar_view_.get()) {
2187 bookmark_bar_view_.reset(new BookmarkBarView(browser_.get(), this)); 2187 bookmark_bar_view_.reset(new BookmarkBarView(browser_.get(), this));
2188 bookmark_bar_view_->set_owned_by_client(); 2188 bookmark_bar_view_->set_owned_by_client();
2189 bookmark_bar_view_->SetBackground( 2189 bookmark_bar_view_->SetBackground(
2190 base::MakeUnique<BookmarkBarViewBackground>(this, 2190 base::MakeUnique<BookmarkBarViewBackground>(this,
2191 bookmark_bar_view_.get())); 2191 bookmark_bar_view_.get()));
2192 bookmark_bar_view_->SetBookmarkBarState( 2192 bookmark_bar_view_->SetBookmarkBarState(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 // of it will ensure it's drawn before the toolbar. 2240 // of it will ensure it's drawn before the toolbar.
2241 AddChildViewAt(bookmark_bar_view_.get(), top_container_index); 2241 AddChildViewAt(bookmark_bar_view_.get(), top_container_index);
2242 } else if (new_parent == top_container_) { 2242 } else if (new_parent == top_container_) {
2243 // BookmarkBarView is attached. 2243 // BookmarkBarView is attached.
2244 2244
2245 // The toolbar is a child of |top_container_|, so making the bookmark bar 2245 // The toolbar is a child of |top_container_|, so making the bookmark bar
2246 // the first child ensures it's drawn before the toolbar. 2246 // the first child ensures it's drawn before the toolbar.
2247 new_parent->AddChildViewAt(bookmark_bar_view_.get(), 0); 2247 new_parent->AddChildViewAt(bookmark_bar_view_.get(), 0);
2248 } else { 2248 } else {
2249 DCHECK(!new_parent); 2249 DCHECK(!new_parent);
2250 // Bookmark bar is being detached from all views because it is hidden. 2250 if (bookmark_bar_view_->get_bookmark_bar_state() ==
2251 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get()); 2251 BookmarkBar::State::HIDDEN) {
2252 // Bookmark bar is being detached from all views if it is hidden.
2253 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get());
2254 }
2252 } 2255 }
2253 } 2256 }
2254 2257
2255 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { 2258 bool BrowserView::MaybeShowInfoBar(WebContents* contents) {
2256 // TODO(beng): Remove this function once the interface between 2259 // TODO(beng): Remove this function once the interface between
2257 // InfoBarContainer, DownloadShelfView and WebContents and this 2260 // InfoBarContainer, DownloadShelfView and WebContents and this
2258 // view is sorted out. 2261 // view is sorted out.
2259 return true; 2262 return true;
2260 } 2263 }
2261 2264
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 } 2669 }
2667 2670
2668 extensions::ActiveTabPermissionGranter* 2671 extensions::ActiveTabPermissionGranter*
2669 BrowserView::GetActiveTabPermissionGranter() { 2672 BrowserView::GetActiveTabPermissionGranter() {
2670 content::WebContents* web_contents = GetActiveWebContents(); 2673 content::WebContents* web_contents = GetActiveWebContents();
2671 if (!web_contents) 2674 if (!web_contents)
2672 return nullptr; 2675 return nullptr;
2673 return extensions::TabHelper::FromWebContents(web_contents) 2676 return extensions::TabHelper::FromWebContents(web_contents)
2674 ->active_tab_permission_granter(); 2677 ->active_tab_permission_granter();
2675 } 2678 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698