18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file. 48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/logging.h" 88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)TranslateBubbleViewStateTransition::TranslateBubbleViewStateTransition( 108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) TranslateBubbleModel::ViewState view_state) 118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) : view_state_(view_state), 128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) view_state_before_advanced_view_(view_state) { 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // The initial view type must not be 'Advanced'. 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DCHECK_NE(TranslateBubbleModel::VIEW_STATE_ADVANCED, view_state_); 158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)void TranslateBubbleViewStateTransition::SetViewState( 188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) TranslateBubbleModel::ViewState view_state) { 198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) view_state_ = view_state; 208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) if (view_state != TranslateBubbleModel::VIEW_STATE_ADVANCED) 218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) view_state_before_advanced_view_ = view_state; 228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)void TranslateBubbleViewStateTransition::GoBackFromAdvanced() { 258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DCHECK(view_state_ == TranslateBubbleModel::VIEW_STATE_ADVANCED); 268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) SetViewState(view_state_before_advanced_view_); 278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 28