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

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

Issue 2899133004: Reduce overdraw on bookmark bar (Closed)
Patch Set: revert change in browserview 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
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // The number of milliseconds between loading animation frames. 193 // The number of milliseconds between loading animation frames.
194 const int kLoadingAnimationFrameTimeMs = 30; 194 const int kLoadingAnimationFrameTimeMs = 30;
195 195
196 // Paints the horizontal border separating the Bookmarks Bar from the Toolbar 196 // Paints the horizontal border separating the Bookmarks Bar from the Toolbar
197 // or page content according to |at_top| with |color|. 197 // or page content according to |at_top| with |color|.
198 void PaintDetachedBookmarkBar(gfx::Canvas* canvas, 198 void PaintDetachedBookmarkBar(gfx::Canvas* canvas,
199 BookmarkBarView* view) { 199 BookmarkBarView* view) {
200 // Paint background for detached state; if animating, this is fade in/out. 200 // Paint background for detached state; if animating, this is fade in/out.
201 const ui::ThemeProvider* tp = view->GetThemeProvider(); 201 const ui::ThemeProvider* tp = view->GetThemeProvider();
202 gfx::Rect fill_rect = view->GetLocalBounds(); 202 gfx::Rect fill_rect = view->GetLocalBounds();
203 // We have to not color the top 1dp, because that should be painted by the
204 // toolbar. We will, however, paint the 1px separator at the bottom of the
205 // first dp. See crbug.com/610359
206 fill_rect.Inset(0, 1, 0, 0);
207 203
208 // In detached mode, the bar is meant to overlap with |contents_container_|. 204 // In detached mode, the bar is meant to overlap with |contents_container_|.
209 // The detached background color may be partially transparent, but the layer 205 // The detached background color may be partially transparent, but the layer
210 // for |view| must be painted opaquely to avoid subpixel anti-aliasing 206 // for |view| must be painted opaquely to avoid subpixel anti-aliasing
211 // artifacts, so we recreate the contents container base color here. 207 // artifacts, so we recreate the contents container base color here.
212 canvas->FillRect(fill_rect, 208 canvas->FillRect(fill_rect,
213 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); 209 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND));
214 canvas->FillRect( 210 canvas->FillRect(
215 fill_rect, 211 fill_rect,
216 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); 212 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND));
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 #endif 2539 #endif
2544 } 2540 }
2545 2541
2546 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { 2542 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
2547 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || 2543 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED ||
2548 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { 2544 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) {
2549 return 0; 2545 return 0;
2550 } 2546 }
2551 // Don't use bookmark_bar_view_->height() which won't be the final height if 2547 // Don't use bookmark_bar_view_->height() which won't be the final height if
2552 // the bookmark bar is animating. 2548 // the bookmark bar is animating.
2553 return chrome::kNTPBookmarkBarHeight - 2549 return chrome::kNTPBookmarkBarHeight;
2554 views::NonClientFrameView::kClientEdgeThickness;
2555 } 2550 }
2556 2551
2557 void BrowserView::ExecuteExtensionCommand( 2552 void BrowserView::ExecuteExtensionCommand(
2558 const extensions::Extension* extension, 2553 const extensions::Extension* extension,
2559 const extensions::Command& command) { 2554 const extensions::Command& command) {
2560 extension_keybinding_registry_->ExecuteCommand(extension->id(), 2555 extension_keybinding_registry_->ExecuteCommand(extension->id(),
2561 command.accelerator()); 2556 command.accelerator());
2562 } 2557 }
2563 2558
2564 ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() { 2559 ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 } 2687 }
2693 2688
2694 extensions::ActiveTabPermissionGranter* 2689 extensions::ActiveTabPermissionGranter*
2695 BrowserView::GetActiveTabPermissionGranter() { 2690 BrowserView::GetActiveTabPermissionGranter() {
2696 content::WebContents* web_contents = GetActiveWebContents(); 2691 content::WebContents* web_contents = GetActiveWebContents();
2697 if (!web_contents) 2692 if (!web_contents)
2698 return nullptr; 2693 return nullptr;
2699 return extensions::TabHelper::FromWebContents(web_contents) 2694 return extensions::TabHelper::FromWebContents(web_contents)
2700 ->active_tab_permission_granter(); 2695 ->active_tab_permission_granter();
2701 } 2696 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/frame/browser_view_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698