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

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: address review 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell_factory.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 "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"
tfarina 2012/03/12 17:24:32 do you really need to include desktop_background_r
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // Shell, public: 304 // Shell, public:
302 305
303 Shell::Shell(ShellDelegate* delegate) 306 Shell::Shell(ShellDelegate* delegate)
304 : root_window_(new aura::RootWindow), 307 : root_window_(new aura::RootWindow),
305 root_filter_(NULL), 308 root_filter_(NULL),
306 delegate_(delegate), 309 delegate_(delegate),
307 audio_controller_(NULL), 310 audio_controller_(NULL),
308 brightness_controller_(NULL), 311 brightness_controller_(NULL),
309 power_status_controller_(NULL), 312 power_status_controller_(NULL),
310 shelf_(NULL), 313 shelf_(NULL),
311 desktop_background_mode_(BACKGROUND_IMAGE),
312 root_window_layout_(NULL), 314 root_window_layout_(NULL),
313 status_widget_(NULL) { 315 status_widget_(NULL) {
314 } 316 }
315 317
316 Shell::~Shell() { 318 Shell::~Shell() {
317 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); 319 RemoveRootWindowEventFilter(partial_screenshot_filter_.get());
318 RemoveRootWindowEventFilter(input_method_filter_.get()); 320 RemoveRootWindowEventFilter(input_method_filter_.get());
319 RemoveRootWindowEventFilter(window_modality_controller_.get()); 321 RemoveRootWindowEventFilter(window_modality_controller_.get());
320 #if !defined(OS_MACOSX) 322 #if !defined(OS_MACOSX)
321 RemoveRootWindowEventFilter(accelerator_filter_.get()); 323 RemoveRootWindowEventFilter(accelerator_filter_.get());
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 tray_->AddTrayItem(tray_brightness); 470 tray_->AddTrayItem(tray_brightness);
469 tray_->AddTrayItem(new internal::TraySettings()); 471 tray_->AddTrayItem(new internal::TraySettings());
470 } 472 }
471 if (!status_widget_) 473 if (!status_widget_)
472 status_widget_ = internal::CreateStatusArea(tray_.get()); 474 status_widget_ = internal::CreateStatusArea(tray_.get());
473 475
474 aura::Window* default_container = 476 aura::Window* default_container =
475 GetContainer(internal::kShellWindowId_DefaultContainer); 477 GetContainer(internal::kShellWindowId_DefaultContainer);
476 launcher_.reset(new Launcher(default_container)); 478 launcher_.reset(new Launcher(default_container));
477 479
480 // This controller needs to be set before SetupManagedWindowMode.
481 desktop_background_controller_.reset(new DesktopBackgroundController);
482
478 InitLayoutManagers(); 483 InitLayoutManagers();
479 484
480 if (!command_line->HasSwitch(switches::kAuraNoShadows)) 485 if (!command_line->HasSwitch(switches::kAuraNoShadows))
481 shadow_controller_.reset(new internal::ShadowController()); 486 shadow_controller_.reset(new internal::ShadowController());
482 487
483 focus_cycler_.reset(new internal::FocusCycler()); 488 focus_cycler_.reset(new internal::FocusCycler());
484 focus_cycler_->AddWidget(status_widget_); 489 focus_cycler_->AddWidget(status_widget_);
485 focus_cycler_->AddWidget(launcher_->widget()); 490 focus_cycler_->AddWidget(launcher_->widget());
486 launcher_->SetFocusCycler(focus_cycler_.get()); 491 launcher_->SetFocusCycler(focus_cycler_.get());
487 492
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (workspace_controller_.get()) 536 if (workspace_controller_.get())
532 workspace_controller_->ShowMenu(widget, location); 537 workspace_controller_->ShowMenu(widget, location);
533 } 538 }
534 539
535 void Shell::ToggleAppList() { 540 void Shell::ToggleAppList() {
536 if (!app_list_.get()) 541 if (!app_list_.get())
537 app_list_.reset(new internal::AppList); 542 app_list_.reset(new internal::AppList);
538 app_list_->SetVisible(!app_list_->IsVisible()); 543 app_list_->SetVisible(!app_list_->IsVisible());
539 } 544 }
540 545
541 void Shell::SetDesktopBackgroundMode(BackgroundMode mode) {
542 if (mode == BACKGROUND_SOLID_COLOR) {
543 // Set a solid black background.
544 // TODO(derat): Remove this in favor of having the compositor only clear the
545 // viewport when there are regions not covered by a layer:
546 // http://crbug.com/113445
547 ui::Layer* background_layer = new ui::Layer(ui::Layer::LAYER_SOLID_COLOR);
548 background_layer->SetColor(SK_ColorBLACK);
549 GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)->
550 layer()->Add(background_layer);
551 root_window_layout_->SetBackgroundLayer(background_layer);
552 root_window_layout_->SetBackgroundWidget(NULL);
553 } else {
554 // Create the desktop background image.
555 root_window_layout_->SetBackgroundLayer(NULL);
556 root_window_layout_->SetBackgroundWidget(
557 internal::CreateDesktopBackground());
558 }
559 desktop_background_mode_ = mode;
560 }
561
562 bool Shell::IsScreenLocked() const { 546 bool Shell::IsScreenLocked() const {
563 const aura::Window* lock_screen_container = GetContainer( 547 const aura::Window* lock_screen_container = GetContainer(
564 internal::kShellWindowId_LockScreenContainer); 548 internal::kShellWindowId_LockScreenContainer);
565 return lock_screen_container->StopsEventPropagation(); 549 return lock_screen_container->StopsEventPropagation();
566 } 550 }
567 551
568 bool Shell::IsModalWindowOpen() const { 552 bool Shell::IsModalWindowOpen() const {
569 const aura::Window* modal_container = GetContainer( 553 const aura::Window* modal_container = GetContainer(
570 internal::kShellWindowId_SystemModalContainer); 554 internal::kShellWindowId_SystemModalContainer);
571 return !modal_container->children().empty(); 555 return !modal_container->children().empty();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 GetContainer(internal::kShellWindowId_DefaultContainer); 595 GetContainer(internal::kShellWindowId_DefaultContainer);
612 // Workspace manager has its own layout managers. 596 // Workspace manager has its own layout managers.
613 workspace_controller_.reset( 597 workspace_controller_.reset(
614 new internal::WorkspaceController(default_container)); 598 new internal::WorkspaceController(default_container));
615 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); 599 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager);
616 600
617 // Ensure launcher is visible. 601 // Ensure launcher is visible.
618 launcher_->widget()->Show(); 602 launcher_->widget()->Show();
619 603
620 // Create the desktop background image. 604 // Create the desktop background image.
621 SetDesktopBackgroundMode(BACKGROUND_IMAGE); 605 desktop_background_controller_->SetDefaultDesktopBackgroundImage();
622 } 606 }
623 607
624 void Shell::DisableWorkspaceGridLayout() { 608 void Shell::DisableWorkspaceGridLayout() {
625 if (workspace_controller_.get()) 609 if (workspace_controller_.get())
626 workspace_controller_->workspace_manager()->set_grid_size(0); 610 workspace_controller_->workspace_manager()->set_grid_size(0);
627 } 611 }
628 612
629 } // namespace ash 613 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698