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

Side by Side Diff: ash/shell.cc

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Save user choosed index to local state Created 8 years, 9 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 "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/app_list/app_list.h" 9 #include "ash/app_list/app_list.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_controller.h"
12 #include "ash/desktop_background/desktop_background_resources.h"
13 #include "ash/desktop_background/desktop_background_view.h"
11 #include "ash/drag_drop/drag_drop_controller.h" 14 #include "ash/drag_drop/drag_drop_controller.h"
12 #include "ash/focus_cycler.h" 15 #include "ash/focus_cycler.h"
13 #include "ash/ime/input_method_event_filter.h" 16 #include "ash/ime/input_method_event_filter.h"
14 #include "ash/launcher/launcher.h" 17 #include "ash/launcher/launcher.h"
15 #include "ash/shell_delegate.h" 18 #include "ash/shell_delegate.h"
16 #include "ash/shell_factory.h" 19 #include "ash/shell_factory.h"
17 #include "ash/shell_window_ids.h" 20 #include "ash/shell_window_ids.h"
18 #include "ash/system/audio/tray_volume.h" 21 #include "ash/system/audio/tray_volume.h"
19 #include "ash/system/brightness/tray_brightness.h" 22 #include "ash/system/brightness/tray_brightness.h"
20 #include "ash/system/settings/tray_settings.h" 23 #include "ash/system/settings/tray_settings.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 470
468 window_modality_controller_.reset(new internal::WindowModalityController); 471 window_modality_controller_.reset(new internal::WindowModalityController);
469 AddRootWindowEventFilter(window_modality_controller_.get()); 472 AddRootWindowEventFilter(window_modality_controller_.get());
470 473
471 visibility_controller_.reset(new internal::VisibilityController); 474 visibility_controller_.reset(new internal::VisibilityController);
472 475
473 tooltip_controller_.reset(new internal::TooltipController); 476 tooltip_controller_.reset(new internal::TooltipController);
474 AddRootWindowEventFilter(tooltip_controller_.get()); 477 AddRootWindowEventFilter(tooltip_controller_.get());
475 478
476 drag_drop_controller_.reset(new internal::DragDropController); 479 drag_drop_controller_.reset(new internal::DragDropController);
480 desktop_background_controller_.reset(new DesktopBackgroundController);
477 power_button_controller_.reset(new PowerButtonController); 481 power_button_controller_.reset(new PowerButtonController);
478 video_detector_.reset(new VideoDetector); 482 video_detector_.reset(new VideoDetector);
479 window_cycle_controller_.reset(new WindowCycleController); 483 window_cycle_controller_.reset(new WindowCycleController);
480 } 484 }
481 485
482 Shell::WindowMode Shell::ComputeWindowMode(CommandLine* command_line) const { 486 Shell::WindowMode Shell::ComputeWindowMode(CommandLine* command_line) const {
483 if (compact_window_mode_for_test_) 487 if (compact_window_mode_for_test_)
484 return MODE_COMPACT; 488 return MODE_COMPACT;
485 489
486 // Some devices don't perform well with overlapping windows. 490 // Some devices don't perform well with overlapping windows.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 if (workspace_controller_.get()) 536 if (workspace_controller_.get())
533 workspace_controller_->ShowMenu(widget, location); 537 workspace_controller_->ShowMenu(widget, location);
534 } 538 }
535 539
536 void Shell::ToggleAppList() { 540 void Shell::ToggleAppList() {
537 if (!app_list_.get()) 541 if (!app_list_.get())
538 app_list_.reset(new internal::AppList); 542 app_list_.reset(new internal::AppList);
539 app_list_->SetVisible(!app_list_->IsVisible()); 543 app_list_->SetVisible(!app_list_->IsVisible());
540 } 544 }
541 545
546 void Shell::SetDesktopBackgroundWallpaper(const SkBitmap& wallpaper) {
547 if (desktop_background_mode_ == BACKGROUND_SOLID_COLOR)
548 return;
549 DCHECK(root_window_layout_->background_widget());
550 static_cast<internal::DesktopBackgroundView*>(
551 root_window_layout_->background_widget()->widget_delegate())->
552 SetWallpaper(wallpaper);
553 }
554
542 void Shell::SetDesktopBackgroundMode(BackgroundMode mode) { 555 void Shell::SetDesktopBackgroundMode(BackgroundMode mode) {
flackr 2012/03/06 17:16:49 I think this function should become SetDesktopBack
bshe 2012/03/06 19:56:16 Just to confirm, your intention here is to enable
flackr 2012/03/06 20:25:28 This is probably important, I think if we start su
bshe 2012/03/07 19:50:44 It seems the ToT build can't switch the color mode
543 if (mode == BACKGROUND_SOLID_COLOR) { 556 if (mode == BACKGROUND_SOLID_COLOR) {
544 // Set a solid black background. 557 // Set a solid black background.
545 // TODO(derat): Remove this in favor of having the compositor only clear the 558 // TODO(derat): Remove this in favor of having the compositor only clear the
546 // viewport when there are regions not covered by a layer: 559 // viewport when there are regions not covered by a layer:
547 // http://crbug.com/113445 560 // http://crbug.com/113445
548 ui::Layer* background_layer = new ui::Layer(ui::Layer::LAYER_SOLID_COLOR); 561 ui::Layer* background_layer = new ui::Layer(ui::Layer::LAYER_SOLID_COLOR);
549 background_layer->SetColor(SK_ColorBLACK); 562 background_layer->SetColor(SK_ColorBLACK);
550 GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)-> 563 GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)->
551 layer()->Add(background_layer); 564 layer()->Add(background_layer);
552 root_window_layout_->SetBackgroundLayer(background_layer); 565 root_window_layout_->SetBackgroundLayer(background_layer);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 void Shell::ResetLayoutManager(int container_id) { 687 void Shell::ResetLayoutManager(int container_id) {
675 GetContainer(container_id)->SetLayoutManager(NULL); 688 GetContainer(container_id)->SetLayoutManager(NULL);
676 } 689 }
677 690
678 void Shell::DisableWorkspaceGridLayout() { 691 void Shell::DisableWorkspaceGridLayout() {
679 if (workspace_controller_.get()) 692 if (workspace_controller_.get())
680 workspace_controller_->workspace_manager()->set_grid_size(0); 693 workspace_controller_->workspace_manager()->set_grid_size(0);
681 } 694 }
682 695
683 } // namespace ash 696 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698