root/chrome/browser/ui/views/location_bar/page_info_helper.cc

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. location_bar_
  2. ProcessEvent

// Copyright (c) 2012 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/page_info_helper.h"

#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "ui/views/view.h"

using content::NavigationController;
using content::NavigationEntry;
using content::WebContents;

PageInfoHelper::PageInfoHelper(const views::View* owner,
                               LocationBarView* location_bar)
    : owner_(owner),
      location_bar_(location_bar) {
}

void PageInfoHelper::ProcessEvent(const ui::LocatedEvent& event) {
  if (!owner_->HitTestPoint(event.location()))
    return;

  WebContents* tab = location_bar_->GetWebContents();
  if (!tab)
    return;
  const NavigationController& controller = tab->GetController();
  // Important to use GetVisibleEntry to match what's showing in the omnibox.
  NavigationEntry* nav_entry = controller.GetVisibleEntry();
  DCHECK(nav_entry);
  location_bar_->delegate()->ShowWebsiteSettings(
      tab, nav_entry->GetURL(), nav_entry->GetSSL());
}

/* [<][>][^][v][top][bottom][index][help] */