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

Unified Diff: chrome/browser/ui/views/infobars/translate_message_infobar.cc

Issue 325483003: Remove unused Views Translate InfoBar code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/infobars/translate_message_infobar.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/infobars/translate_message_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/translate_message_infobar.cc b/chrome/browser/ui/views/infobars/translate_message_infobar.cc
deleted file mode 100644
index 4d284c62bea1bf59e42729002807e3f55dcd1c94..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/views/infobars/translate_message_infobar.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2011 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/ui/views/infobars/translate_message_infobar.h"
-
-#include "components/translate/core/browser/translate_infobar_delegate.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/label.h"
-
-TranslateMessageInfoBar::TranslateMessageInfoBar(
- scoped_ptr<TranslateInfoBarDelegate> delegate)
- : TranslateInfoBarBase(delegate.Pass()),
- label_(NULL),
- button_(NULL) {
-}
-
-TranslateMessageInfoBar::~TranslateMessageInfoBar() {
-}
-
-void TranslateMessageInfoBar::Layout() {
- TranslateInfoBarBase::Layout();
-
- int x = StartX();
- const int width =
- std::min(label_->width(), std::max(0, EndX() - x - NonLabelWidth()));
- label_->SetBounds(x, OffsetY(label_), width, label_->height());
- if (!label_->text().empty())
- x = label_->bounds().right() + kEndOfLabelSpacing;
-
- if (button_)
- button_->SetPosition(gfx::Point(x, OffsetY(button_)));
-}
-
-void TranslateMessageInfoBar::ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) {
- if (details.is_add && (details.child == this) && (label_ == NULL)) {
- TranslateInfoBarDelegate* delegate = GetDelegate();
- label_ = CreateLabel(delegate->GetMessageInfoBarText());
- AddChildView(label_);
-
- base::string16 button_text(delegate->GetMessageInfoBarButtonText());
- if (!button_text.empty()) {
- button_ = CreateLabelButton(this, button_text);
- AddChildView(button_);
- }
- }
-
- // This must happen after adding all other children so InfoBarView can ensure
- // the close button is the last child.
- TranslateInfoBarBase::ViewHierarchyChanged(details);
-}
-
-void TranslateMessageInfoBar::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- if (!owner())
- return; // We're closing; don't call anything, it might access the owner.
- if (sender == button_)
- GetDelegate()->MessageInfoBarButtonPressed();
- else
- TranslateInfoBarBase::ButtonPressed(sender, event);
-}
-
-int TranslateMessageInfoBar::ContentMinimumWidth() const {
- return label_->GetMinimumSize().width() + NonLabelWidth();
-}
-
-int TranslateMessageInfoBar::NonLabelWidth() const {
- if (!button_)
- return 0;
- return button_->width() + (label_->text().empty() ? 0 : kEndOfLabelSpacing);
-}
« no previous file with comments | « chrome/browser/ui/views/infobars/translate_message_infobar.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698