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

Side by Side Diff: chrome/browser/chromeos/login/user_image_screen.cc

Issue 4228002: Moved ownership of camera thread to user image screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 10 years, 1 month 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 | « chrome/browser/chromeos/login/user_image_screen.h ('k') | no next file » | 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) 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/user_image_screen.h" 5 #include "chrome/browser/chromeos/login/user_image_screen.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/chromeos/login/login_utils.h" 10 #include "chrome/browser/chromeos/login/login_utils.h"
(...skipping 13 matching lines...) Expand all
24 const int kFrameWidth = 480; 24 const int kFrameWidth = 480;
25 const int kFrameHeight = 480; 25 const int kFrameHeight = 480;
26 26
27 // Maximum number of capture failures we ignore before we try to initialize 27 // Maximum number of capture failures we ignore before we try to initialize
28 // the camera again. 28 // the camera again.
29 const int kMaxCaptureFailureCounter = 5; 29 const int kMaxCaptureFailureCounter = 5;
30 30
31 // Maximum number of camera initialization retries. 31 // Maximum number of camera initialization retries.
32 const int kMaxCameraInitFailureCounter = 3; 32 const int kMaxCameraInitFailureCounter = 3;
33 33
34 // Name for camera thread.
35 const char kCameraThreadName[] = "Chrome_CameraThread";
36
34 } // namespace 37 } // namespace
35 38
36 UserImageScreen::UserImageScreen(WizardScreenDelegate* delegate) 39 UserImageScreen::UserImageScreen(WizardScreenDelegate* delegate)
37 : ViewScreen<UserImageView>(delegate), 40 : ViewScreen<UserImageView>(delegate),
38 ALLOW_THIS_IN_INITIALIZER_LIST(camera_(new Camera(this, true))),
39 capture_failure_counter_(0), 41 capture_failure_counter_(0),
40 camera_init_failure_counter_(0) { 42 camera_init_failure_counter_(0),
43 camera_thread_(kCameraThreadName) {
41 registrar_.Add( 44 registrar_.Add(
42 this, 45 this,
43 NotificationType::SCREEN_LOCK_STATE_CHANGED, 46 NotificationType::SCREEN_LOCK_STATE_CHANGED,
44 NotificationService::AllSources()); 47 NotificationService::AllSources());
48 camera_thread_.Start();
49 camera_ = new Camera(this, &camera_thread_, true);
45 camera_->Initialize(kFrameWidth, kFrameHeight); 50 camera_->Initialize(kFrameWidth, kFrameHeight);
46 } 51 }
47 52
48 UserImageScreen::~UserImageScreen() { 53 UserImageScreen::~UserImageScreen() {
49 if (camera_.get()) 54 if (camera_.get())
50 camera_->set_delegate(NULL); 55 camera_->set_delegate(NULL);
51 } 56 }
52 57
53 void UserImageScreen::Refresh() { 58 void UserImageScreen::Refresh() {
54 } 59 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 152
148 bool is_screen_locked = *Details<bool>(details).ptr(); 153 bool is_screen_locked = *Details<bool>(details).ptr();
149 if (is_screen_locked) 154 if (is_screen_locked)
150 camera_->Uninitialize(); 155 camera_->Uninitialize();
151 else 156 else
152 camera_->Initialize(kFrameWidth, kFrameHeight); 157 camera_->Initialize(kFrameWidth, kFrameHeight);
153 } 158 }
154 159
155 } // namespace chromeos 160 } // namespace chromeos
156 161
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_screen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698