1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h"
7 #include "base/logging.h"
9 TranslateBubbleViewStateTransition::TranslateBubbleViewStateTransition(
10 TranslateBubbleModel::ViewState view_state
)
11 : view_state_(view_state
),
12 view_state_before_advanced_view_(view_state
) {
13 // The initial view type must not be 'Advanced'.
14 DCHECK_NE(TranslateBubbleModel::VIEW_STATE_ADVANCED
, view_state_
);
17 void TranslateBubbleViewStateTransition::SetViewState(
18 TranslateBubbleModel::ViewState view_state
) {
19 view_state_
= view_state
;
20 if (view_state
!= TranslateBubbleModel::VIEW_STATE_ADVANCED
)
21 view_state_before_advanced_view_
= view_state
;
24 void TranslateBubbleViewStateTransition::GoBackFromAdvanced() {
25 DCHECK(view_state_
== TranslateBubbleModel::VIEW_STATE_ADVANCED
);
26 SetViewState(view_state_before_advanced_view_
);