| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 } | 576 } |
| 577 | 577 |
| 578 lock_widget_ = new GrabWidget(this); | 578 lock_widget_ = new GrabWidget(this); |
| 579 lock_widget_->MakeTransparent(); | 579 lock_widget_->MakeTransparent(); |
| 580 lock_widget_->InitWithWidget(lock_window_, gfx::Rect()); | 580 lock_widget_->InitWithWidget(lock_window_, gfx::Rect()); |
| 581 if (screen_lock_view_) { | 581 if (screen_lock_view_) { |
| 582 lock_widget_->SetContentsView( | 582 lock_widget_->SetContentsView( |
| 583 new GrabWidgetRootView(screen_lock_view_)); | 583 new GrabWidgetRootView(screen_lock_view_)); |
| 584 } | 584 } |
| 585 | 585 |
| 586 lock_widget_->Show(); | |
| 587 | |
| 588 // Configuring the background url. | 586 // Configuring the background url. |
| 589 std::string url_string = | 587 std::string url_string = |
| 590 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 588 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 591 switches::kScreenSaverUrl); | 589 switches::kScreenSaverUrl); |
| 592 background_view_ = new ScreenLockerBackgroundView(lock_widget_, | 590 background_view_ = new ScreenLockerBackgroundView(lock_widget_, |
| 593 screen_lock_view_); | 591 screen_lock_view_); |
| 594 background_view_->Init(GURL(url_string)); | 592 background_view_->Init(GURL(url_string)); |
| 595 if (background_view_->ScreenSaverEnabled()) | 593 if (background_view_->ScreenSaverEnabled()) |
| 596 StartScreenSaver(); | 594 StartScreenSaver(); |
| 597 | 595 |
| 598 DCHECK(GTK_WIDGET_REALIZED(lock_window_->GetNativeView())); | 596 DCHECK(GTK_WIDGET_REALIZED(lock_window_->GetNativeView())); |
| 599 WmIpc::instance()->SetWindowType( | 597 WmIpc::instance()->SetWindowType( |
| 600 lock_window_->GetNativeView(), | 598 lock_window_->GetNativeView(), |
| 601 WM_IPC_WINDOW_CHROME_SCREEN_LOCKER, | 599 WM_IPC_WINDOW_CHROME_SCREEN_LOCKER, |
| 602 NULL); | 600 NULL); |
| 603 | 601 |
| 604 lock_window_->SetContentsView(background_view_); | 602 lock_window_->SetContentsView(background_view_); |
| 605 lock_window_->Show(); | 603 lock_window_->Show(); |
| 606 | 604 |
| 605 // Show lock_widget after the lock_window is shown so that |
| 606 // we can grab inputs immediately. |
| 607 lock_widget_->Show(); |
| 608 |
| 607 // Don't let X draw default background, which was causing flash on | 609 // Don't let X draw default background, which was causing flash on |
| 608 // resume. | 610 // resume. |
| 609 gdk_window_set_back_pixmap(lock_window_->GetNativeView()->window, | 611 gdk_window_set_back_pixmap(lock_window_->GetNativeView()->window, |
| 610 NULL, false); | 612 NULL, false); |
| 611 gdk_window_set_back_pixmap(lock_widget_->GetNativeView()->window, | 613 gdk_window_set_back_pixmap(lock_widget_->GetNativeView()->window, |
| 612 NULL, false); | 614 NULL, false); |
| 613 lock_window->set_toplevel_focus_widget(lock_widget_->window_contents()); | 615 lock_window->set_toplevel_focus_widget(lock_widget_->window_contents()); |
| 614 | 616 |
| 615 // Create the SystemKeyEventListener so it can listen for system keyboard | 617 // Create the SystemKeyEventListener so it can listen for system keyboard |
| 616 // messages regardless of focus while screen locked. | 618 // messages regardless of focus while screen locked. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 | 907 |
| 906 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { | 908 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 907 if (!background_view_->IsScreenSaverVisible()) { | 909 if (!background_view_->IsScreenSaverVisible()) { |
| 908 StartScreenSaver(); | 910 StartScreenSaver(); |
| 909 return true; | 911 return true; |
| 910 } | 912 } |
| 911 return false; | 913 return false; |
| 912 } | 914 } |
| 913 | 915 |
| 914 } // namespace chromeos | 916 } // namespace chromeos |
| OLD | NEW |