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

Side by Side Diff: ui/app_list/views/app_list_item_view.cc

Issue 305013014: Disable folder UI when app sync is disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/test/app_list_test_view_delegate.cc ('k') | ui/app_list/views/app_list_main_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/app_list/views/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
11 #include "ui/accessibility/ax_view_state.h" 11 #include "ui/accessibility/ax_view_state.h"
12 #include "ui/app_list/app_list_constants.h" 12 #include "ui/app_list/app_list_constants.h"
13 #include "ui/app_list/app_list_folder_item.h" 13 #include "ui/app_list/app_list_folder_item.h"
14 #include "ui/app_list/app_list_item.h" 14 #include "ui/app_list/app_list_item.h"
15 #include "ui/app_list/app_list_switches.h"
16 #include "ui/app_list/views/apps_grid_view.h" 15 #include "ui/app_list/views/apps_grid_view.h"
17 #include "ui/app_list/views/cached_label.h" 16 #include "ui/app_list/views/cached_label.h"
18 #include "ui/app_list/views/progress_bar_view.h" 17 #include "ui/app_list/views/progress_bar_view.h"
19 #include "ui/base/dragdrop/drag_utils.h" 18 #include "ui/base/dragdrop/drag_utils.h"
20 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
23 #include "ui/compositor/scoped_layer_animation_settings.h" 22 #include "ui/compositor/scoped_layer_animation_settings.h"
24 #include "ui/gfx/animation/throb_animation.h" 23 #include "ui/gfx/animation/throb_animation.h"
25 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return; 336 return;
338 337
339 gfx::Rect rect(GetContentsBounds()); 338 gfx::Rect rect(GetContentsBounds());
340 if (item_->highlighted() && !item_->is_installing()) { 339 if (item_->highlighted() && !item_->is_installing()) {
341 canvas->FillRect(rect, kHighlightedColor); 340 canvas->FillRect(rect, kHighlightedColor);
342 return; 341 return;
343 } else if (apps_grid_view_->IsSelectedView(this)) { 342 } else if (apps_grid_view_->IsSelectedView(this)) {
344 canvas->FillRect(rect, kSelectedColor); 343 canvas->FillRect(rect, kSelectedColor);
345 } 344 }
346 345
347 if (!switches::IsFolderUIEnabled()) { 346 if (!apps_grid_view_->model()->folders_enabled()) {
348 if (apps_grid_view_->IsSelectedView(this)) { 347 if (apps_grid_view_->IsSelectedView(this)) {
349 canvas->FillRect(rect, kSelectedColor); 348 canvas->FillRect(rect, kSelectedColor);
350 } else if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 349 } else if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
351 canvas->FillRect(rect, kHighlightedColor); 350 canvas->FillRect(rect, kHighlightedColor);
352 } 351 }
353 } else if (ui_state_ == UI_STATE_DROPPING_IN_FOLDER) { 352 } else if (ui_state_ == UI_STATE_DROPPING_IN_FOLDER) {
354 // Draw folder dropping preview circle. 353 // Draw folder dropping preview circle.
355 gfx::Point center = gfx::Point(icon_->x() + icon_->size().width() / 2, 354 gfx::Point center = gfx::Point(icon_->x() + icon_->size().width() / 2,
356 icon_->y() + icon_->size().height() / 2); 355 icon_->y() + icon_->size().height() / 2);
357 SkPaint paint; 356 SkPaint paint;
(...skipping 17 matching lines...) Expand all
375 gfx::Rect(point, gfx::Size()), 374 gfx::Rect(point, gfx::Size()),
376 views::MENU_ANCHOR_TOPLEFT, 375 views::MENU_ANCHOR_TOPLEFT,
377 source_type, 376 source_type,
378 views::MenuRunner::HAS_MNEMONICS) == 377 views::MenuRunner::HAS_MNEMONICS) ==
379 views::MenuRunner::MENU_DELETED) { 378 views::MenuRunner::MENU_DELETED) {
380 return; 379 return;
381 } 380 }
382 } 381 }
383 382
384 void AppListItemView::StateChanged() { 383 void AppListItemView::StateChanged() {
385 const bool is_folder_ui_enabled = switches::IsFolderUIEnabled(); 384 const bool is_folder_ui_enabled = apps_grid_view_->model()->folders_enabled();
386 if (is_folder_ui_enabled) 385 if (is_folder_ui_enabled)
387 apps_grid_view_->ClearAnySelectedView(); 386 apps_grid_view_->ClearAnySelectedView();
388 387
389 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 388 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
390 if (!is_folder_ui_enabled) 389 if (!is_folder_ui_enabled)
391 apps_grid_view_->SetSelectedView(this); 390 apps_grid_view_->SetSelectedView(this);
392 title_->SetEnabledColor(kGridTitleHoverColor); 391 title_->SetEnabledColor(kGridTitleHoverColor);
393 } else { 392 } else {
394 if (!is_folder_ui_enabled) 393 if (!is_folder_ui_enabled)
395 apps_grid_view_->ClearSelectedView(this); 394 apps_grid_view_->ClearSelectedView(this);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 const int left_right_padding = 528 const int left_right_padding =
530 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars); 529 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars);
531 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); 530 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0);
532 531
533 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height()); 532 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height());
534 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); 533 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_));
535 return icon_bounds; 534 return icon_bounds;
536 } 535 }
537 536
538 } // namespace app_list 537 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/test/app_list_test_view_delegate.cc ('k') | ui/app_list/views/app_list_main_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698