#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/elide_url.h"
+#include "chrome/browser/ui/location_bar/origin_chip_info.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
-#include "chrome/browser/ui/toolbar/origin_chip_info.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
location_bar_view_(location_bar_view),
profile_(profile),
showing_16x16_icon_(false),
- fade_in_animation_(this) {
+ fade_in_animation_(this),
+ security_level_(ToolbarModel::NONE),
+ url_malware_(false) {
EnableCanvasFlippingForRTLUI(true);
scoped_refptr<SafeBrowsingService> sb_service =
g_browser_process->safe_browsing_service();
- // May not be set for unit tests.
+ // |sb_service| may be NULL in tests.
if (sb_service && sb_service->ui_manager())
sb_service->ui_manager()->AddObserver(this);
ev_label_ = new views::Label(base::string16(), GetFontList());
ev_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- ev_label_->SetElideBehavior(gfx::TRUNCATE);
+ ev_label_->SetElideBehavior(gfx::NO_ELIDE);
AddChildView(ev_label_);
host_label_ = new views::Label(base::string16(), GetFontList());
host_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- host_label_->SetElideBehavior(gfx::TRUNCATE);
+ host_label_->SetElideBehavior(gfx::NO_ELIDE);
AddChildView(host_label_);
fade_in_animation_.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN);
fade_in_animation_.SetSlideDuration(175);
+
+ // Ensure |pressed_text_color_| and |background_colors_| are initialized.
+ SetBorderImages(kNormalImages);
}
OriginChipView::~OriginChipView() {
// of the background, which we treat as the representative color of the
// entire background (reasonable, given the current appearance of these
// images).
+ //
+ // NOTE: Because this is called from the constructor, when we're not in a
+ // Widget yet, GetThemeProvider() may return NULL, so use the location bar's
+ // theme provider instead to be safe.
const SkBitmap& bitmap(
- GetThemeProvider()->GetImageSkiaNamed(
+ location_bar_view_->GetThemeProvider()->GetImageSkiaNamed(
images[i][4])->GetRepresentation(1.0f).sk_bitmap());
SkAutoLockPixels pixel_lock(bitmap);
background_colors_[i] =