summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/location_bar/location_icon_view.cc
blob: 2846337f3b88af2b25f4fab5dd3b6f602e7d1671 (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
// 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/location_bar/location_icon_view.h"

#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"

LocationIconView::LocationIconView(LocationBarView* location_bar)
    : ALLOW_THIS_IN_INITIALIZER_LIST(click_handler_(this, location_bar)) {
  SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
      IDS_TOOLTIP_LOCATION_ICON)));
}

LocationIconView::~LocationIconView() {
}

bool LocationIconView::OnMousePressed(const views::MouseEvent& event) {
  // We want to show the dialog on mouse release; that is the standard behavior
  // for buttons.
  return true;
}

void LocationIconView::OnMouseReleased(const views::MouseEvent& event) {
  click_handler_.OnMouseReleased(event);
}

void LocationIconView::ShowTooltip(bool show) {
  if (show) {
    SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
            IDS_TOOLTIP_LOCATION_ICON)));
  } else {
    SetTooltipText(L"");
  }
}