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

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

Issue 2549373005: cros: Refactor of BaseScreen::GetName to BaseScreen::screen_id. (Closed)
Patch Set: Nits 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return *this; 60 return *this;
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 : channel_(nullptr), base_screen_delegate_(base_screen_delegate) { 71 const std::string& screen_id)
72 } 72 : base_screen_delegate_(base_screen_delegate), screen_id_(screen_id) {}
73 73
74 BaseScreen::~BaseScreen() { 74 BaseScreen::~BaseScreen() {
75 } 75 }
76 76
77 void BaseScreen::Initialize(::login::ScreenContext* context) { 77 void BaseScreen::Initialize(::login::ScreenContext* context) {
78 if (context) 78 if (context)
79 context_.CopyFrom(*context); 79 context_.CopyFrom(*context);
80 } 80 }
81 81
82 void BaseScreen::OnShow() { 82 void BaseScreen::OnShow() {
83 } 83 }
84 84
85 void BaseScreen::OnHide() { 85 void BaseScreen::OnHide() {
86 } 86 }
87 87
88 void BaseScreen::OnClose() { 88 void BaseScreen::OnClose() {
89 } 89 }
90 90
91 bool BaseScreen::IsStatusAreaDisplayed() { 91 bool BaseScreen::IsStatusAreaDisplayed() {
92 return true; 92 return true;
93 } 93 }
94 94
95 std::string BaseScreen::GetID() const {
96 // TODO (ygorshenin, crbug.com/433797): elimitate intermediate
97 // GetName() ASAP.
98 return GetName();
99 }
100
101 void BaseScreen::CommitContextChanges() { 95 void BaseScreen::CommitContextChanges() {
102 if (!context_.HasChanges()) 96 if (!context_.HasChanges())
103 return; 97 return;
104 if (!channel_) { 98 if (!channel_) {
105 LOG(ERROR) << "Model-view channel for " << GetID() 99 LOG(ERROR) << "Model-view channel for " << screen_id()
106 << " is not ready, context changes are not sent to the view."; 100 << " is not ready, context changes are not sent to the view.";
107 return; 101 return;
108 } 102 }
109 base::DictionaryValue diff; 103 base::DictionaryValue diff;
110 context_.GetChangesAndReset(&diff); 104 context_.GetChangesAndReset(&diff);
111 channel_->CommitContextChanges(diff); 105 channel_->CommitContextChanges(diff);
112 } 106 }
113 107
114 void BaseScreen::Finish(BaseScreenDelegate::ExitCodes exit_code) { 108 void BaseScreen::Finish(BaseScreenDelegate::ExitCodes exit_code) {
115 base_screen_delegate_->OnExit(*this, exit_code, &context_); 109 base_screen_delegate_->OnExit(*this, exit_code, &context_);
(...skipping 18 matching lines...) Expand all
134 } 128 }
135 129
136 void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) { 130 void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) {
137 std::vector<::login::ScreenContext::KeyType> keys; 131 std::vector<::login::ScreenContext::KeyType> keys;
138 context_.ApplyChanges(diff, &keys); 132 context_.ApplyChanges(diff, &keys);
139 for (const auto& key : keys) 133 for (const auto& key : keys)
140 OnContextKeyUpdated(key); 134 OnContextKeyUpdated(key);
141 } 135 }
142 136
143 } // namespace chromeos 137 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/base_screen.h ('k') | chrome/browser/chromeos/login/screens/controller_pairing_screen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698