summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/info_bar_message_view.cc
blob: 07098c7939913d095c33e58534f577ac50620136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/views/info_bar_message_view.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/label.h"

InfoBarMessageView::InfoBarMessageView(const std::wstring& message)
    : message_string_(message),
      message_label_(NULL) {
  Init();
}

InfoBarMessageView::InfoBarMessageView(ChromeViews::Label* message)
    : message_string_(),
      message_label_(message) {
  Init();
}

InfoBarMessageView::~InfoBarMessageView() {}

void InfoBarMessageView::SetMessageText(const std::wstring& message) {
  message_label_->SetText(message);
  Layout();
}

std::wstring InfoBarMessageView::GetMessageText() {
  return message_label_->GetText();
}

void InfoBarMessageView::Init() {
  if (message_label_ == NULL) {
    message_label_ = new ChromeViews::Label(message_string_);
    message_label_->SetFont(
      ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
  } else {
    message_string_ = message_label_->GetText();
  }

  AddChildViewLeading(message_label_);
}