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

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

Issue 10662032: alternate ntp (cros/partial-win): add tab-related stuff and toolbar/tab background change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed scott's comments Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/themes/theme_service.h" 12 #include "chrome/browser/themes/theme_service.h"
13 #include "chrome/browser/ui/search/search.h"
14 #include "chrome/browser/ui/search/search_model.h"
13 #include "chrome/browser/ui/views/avatar_menu_button.h" 15 #include "chrome/browser/ui/views/avatar_menu_button.h"
14 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
15 #include "chrome/browser/ui/views/tabs/tab.h" 17 #include "chrome/browser/ui/views/tabs/tab.h"
16 #include "chrome/browser/ui/views/tabs/tab_strip.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip.h"
17 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
18 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
20 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
21 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
22 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 ui::ThemeProvider* tp = GetThemeProvider(); 275 ui::ThemeProvider* tp = GetThemeProvider();
274 276
275 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); 277 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds());
276 gfx::Point toolbar_origin(toolbar_bounds.origin()); 278 gfx::Point toolbar_origin(toolbar_bounds.origin());
277 View::ConvertPointToView(browser_view(), this, &toolbar_origin); 279 View::ConvertPointToView(browser_view(), this, &toolbar_origin);
278 toolbar_bounds.set_origin(toolbar_origin); 280 toolbar_bounds.set_origin(toolbar_origin);
279 int x = toolbar_bounds.x(); 281 int x = toolbar_bounds.x();
280 int w = toolbar_bounds.width(); 282 int w = toolbar_bounds.width();
281 int left_x = x - kContentEdgeShadowThickness; 283 int left_x = x - kContentEdgeShadowThickness;
282 284
283 gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); 285 // TODO(kuan): migrate background animation from cros to win by calling
286 // GetToolbarBackgound* with the correct mode, refer to
287 // BrowserNonClientFrameViewAsh.
288 gfx::ImageSkia* theme_toolbar = browser_view()->GetToolbarBackgroundImage(
289 browser_view()->browser()->search_model()->mode().mode);
284 gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed( 290 gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed(
285 IDR_CONTENT_TOP_LEFT_CORNER); 291 IDR_CONTENT_TOP_LEFT_CORNER);
286 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed( 292 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed(
287 IDR_CONTENT_TOP_CENTER); 293 IDR_CONTENT_TOP_CENTER);
288 294
289 // Tile the toolbar image starting at the frame edge on the left and where 295 // Tile the toolbar image starting at the frame edge on the left and where
290 // the tabstrip is on the top. 296 // the tabstrip is on the top.
291 int y = toolbar_bounds.y(); 297 int y = toolbar_bounds.y();
292 int dest_y = y + (kFrameShadowThickness * 2); 298 int dest_y = y + (kFrameShadowThickness * 2);
293 canvas->TileImageInt(*theme_toolbar, x, 299 canvas->TileImageInt(*theme_toolbar, x,
(...skipping 24 matching lines...) Expand all
318 canvas->DrawImageInt(*toolbar_left, left_x, y); 324 canvas->DrawImageInt(*toolbar_left, left_x, y);
319 325
320 // Draw center edge. 326 // Draw center edge.
321 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, 327 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y,
322 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); 328 right_x - (left_x + toolbar_left->width()), toolbar_center->height());
323 329
324 // Right edge. 330 // Right edge.
325 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), 331 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER),
326 right_x, y); 332 right_x, y);
327 333
328 // Draw the content/toolbar separator. 334 // Only draw the content/toolbar separator if Instant Extended API is disabled
329 canvas->FillRect(gfx::Rect(x + kClientEdgeThickness, 335 // or mode is DEFAULT.
330 toolbar_bounds.bottom() - kClientEdgeThickness, 336 Browser* browser = browser_view()->browser();
331 w - (2 * kClientEdgeThickness), 337 bool extended_instant_enabled = chrome::search::IsInstantExtendedAPIEnabled(
332 kClientEdgeThickness), 338 browser->profile());
333 ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR)); 339 if (!extended_instant_enabled ||
340 browser->search_model()->mode().is_default()) {
341 canvas->FillRect(
342 gfx::Rect(x + kClientEdgeThickness,
343 toolbar_bounds.bottom() - kClientEdgeThickness,
344 w - (2 * kClientEdgeThickness),
345 kClientEdgeThickness),
346 ThemeService::GetDefaultColor(extended_instant_enabled ?
347 ThemeService::COLOR_SEARCH_SEPARATOR_LINE :
348 ThemeService::COLOR_TOOLBAR_SEPARATOR));
349 }
334 } 350 }
335 351
336 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { 352 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {
337 ui::ThemeProvider* tp = GetThemeProvider(); 353 ui::ThemeProvider* tp = GetThemeProvider();
338 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); 354 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
339 355
340 // The client edges start below the toolbar upper corner images regardless 356 // The client edges start below the toolbar upper corner images regardless
341 // of how tall the toolbar itself is. 357 // of how tall the toolbar itself is.
342 int client_area_top = frame()->client_view()->y() + 358 int client_area_top = frame()->client_view()->y() +
343 browser_view()->GetToolbarBounds().y() + 359 browser_view()->GetToolbarBounds().y() +
(...skipping 18 matching lines...) Expand all
362 canvas->DrawImageInt(*bottom_left, 378 canvas->DrawImageInt(*bottom_left,
363 client_area_bounds.x() - bottom_left->width(), client_area_bottom); 379 client_area_bounds.x() - bottom_left->width(), client_area_bottom);
364 gfx::ImageSkia* left = tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE); 380 gfx::ImageSkia* left = tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE);
365 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), 381 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(),
366 client_area_top, left->width(), client_area_height); 382 client_area_top, left->width(), client_area_height);
367 383
368 // Draw the toolbar color so that the client edges show the right color even 384 // Draw the toolbar color so that the client edges show the right color even
369 // where not covered by the toolbar image. NOTE: We do this after drawing the 385 // where not covered by the toolbar image. NOTE: We do this after drawing the
370 // images because the images are meant to alpha-blend atop the frame whereas 386 // images because the images are meant to alpha-blend atop the frame whereas
371 // these rects are meant to be fully opaque, without anything overlaid. 387 // these rects are meant to be fully opaque, without anything overlaid.
372 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); 388 SkColor toolbar_color = browser_view()->GetToolbarBackgroundColor(
389 browser_view()->browser()->search_model()->mode().mode);
373 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, 390 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness,
374 client_area_top, kClientEdgeThickness, 391 client_area_top, kClientEdgeThickness,
375 client_area_bottom + kClientEdgeThickness - client_area_top), 392 client_area_bottom + kClientEdgeThickness - client_area_top),
376 toolbar_color); 393 toolbar_color);
377 canvas->FillRect(gfx::Rect(client_area_bounds.x(), client_area_bottom, 394 canvas->FillRect(gfx::Rect(client_area_bounds.x(), client_area_bottom,
378 client_area_bounds.width(), kClientEdgeThickness), 395 client_area_bounds.width(), kClientEdgeThickness),
379 toolbar_color); 396 toolbar_color);
380 canvas->FillRect(gfx::Rect(client_area_bounds.right(), client_area_top, 397 canvas->FillRect(gfx::Rect(client_area_bounds.right(), client_area_top,
381 kClientEdgeThickness, 398 kClientEdgeThickness,
382 client_area_bottom + kClientEdgeThickness - client_area_top), 399 client_area_bottom + kClientEdgeThickness - client_area_top),
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 static bool initialized = false; 515 static bool initialized = false;
499 if (!initialized) { 516 if (!initialized) {
500 for (int i = 0; i < kThrobberIconCount; ++i) { 517 for (int i = 0; i < kThrobberIconCount; ++i) {
501 throbber_icons_[i] = 518 throbber_icons_[i] =
502 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 519 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
503 DCHECK(throbber_icons_[i]); 520 DCHECK(throbber_icons_[i]);
504 } 521 }
505 initialized = true; 522 initialized = true;
506 } 523 }
507 } 524 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698