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

Side by Side Diff: chrome/browser/chromeos/login/screens/base_screen.cc

Issue 2566443005: cros: Replace WizardController string constants with OobeScreen values. (Closed)
Patch Set: Address comments Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/screens/base_screen.h" 5 #include "chrome/browser/chromeos/login/screens/base_screen.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" 8 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
9 #include "chrome/browser/chromeos/login/screens/model_view_channel.h" 9 #include "chrome/browser/chromeos/login/screens/model_view_channel.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 const BaseScreen::ContextEditor& BaseScreen::ContextEditor::SetString16List( 63 const BaseScreen::ContextEditor& BaseScreen::ContextEditor::SetString16List(
64 const KeyType& key, 64 const KeyType& key,
65 const String16List& value) const { 65 const String16List& value) const {
66 context_.SetString16List(key, value); 66 context_.SetString16List(key, value);
67 return *this; 67 return *this;
68 } 68 }
69 69
70 BaseScreen::BaseScreen(BaseScreenDelegate* base_screen_delegate, 70 BaseScreen::BaseScreen(BaseScreenDelegate* base_screen_delegate,
71 const std::string& screen_id) 71 OobeScreen screen_id)
72 : base_screen_delegate_(base_screen_delegate), screen_id_(screen_id) {} 72 : base_screen_delegate_(base_screen_delegate), screen_id_(screen_id) {}
73 73
74 BaseScreen::~BaseScreen() { 74 BaseScreen::~BaseScreen() {}
75 }
76 75
77 void BaseScreen::Initialize(::login::ScreenContext* context) { 76 void BaseScreen::Initialize(::login::ScreenContext* context) {
78 if (context) 77 if (context)
79 context_.CopyFrom(*context); 78 context_.CopyFrom(*context);
80 } 79 }
81 80
82 void BaseScreen::OnShow() { 81 void BaseScreen::OnShow() {
83 } 82 }
84 83
85 void BaseScreen::OnHide() { 84 void BaseScreen::OnHide() {
86 } 85 }
87 86
88 void BaseScreen::OnClose() { 87 void BaseScreen::OnClose() {
89 } 88 }
90 89
91 bool BaseScreen::IsStatusAreaDisplayed() { 90 bool BaseScreen::IsStatusAreaDisplayed() {
92 return true; 91 return true;
93 } 92 }
94 93
95 void BaseScreen::CommitContextChanges() { 94 void BaseScreen::CommitContextChanges() {
96 if (!context_.HasChanges()) 95 if (!context_.HasChanges())
97 return; 96 return;
98 if (!channel_) { 97 if (!channel_) {
99 LOG(ERROR) << "Model-view channel for " << screen_id() 98 LOG(ERROR) << "Model-view channel for " << GetOobeScreenName(screen_id())
100 << " is not ready, context changes are not sent to the view."; 99 << " is not ready, context changes are not sent to the view.";
101 return; 100 return;
102 } 101 }
103 base::DictionaryValue diff; 102 base::DictionaryValue diff;
104 context_.GetChangesAndReset(&diff); 103 context_.GetChangesAndReset(&diff);
105 channel_->CommitContextChanges(diff); 104 channel_->CommitContextChanges(diff);
106 } 105 }
107 106
108 void BaseScreen::Finish(BaseScreenDelegate::ExitCodes exit_code) { 107 void BaseScreen::Finish(BaseScreenDelegate::ExitCodes exit_code) {
109 base_screen_delegate_->OnExit(*this, exit_code, &context_); 108 base_screen_delegate_->OnExit(*this, exit_code, &context_);
(...skipping 18 matching lines...) Expand all
128 } 127 }
129 128
130 void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) { 129 void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) {
131 std::vector<::login::ScreenContext::KeyType> keys; 130 std::vector<::login::ScreenContext::KeyType> keys;
132 context_.ApplyChanges(diff, &keys); 131 context_.ApplyChanges(diff, &keys);
133 for (const auto& key : keys) 132 for (const auto& key : keys)
134 OnContextKeyUpdated(key); 133 OnContextKeyUpdated(key);
135 } 134 }
136 135
137 } // namespace chromeos 136 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698