summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 21:54:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 21:54:33 +0000
commit56f959eee5652b24c3ea5efcb243fc999cd4a6a8 (patch)
tree53b6f407dbde63834a5870145fbf8d9f144dcde5 /chrome/browser/views
parent87be5b65d9047caec52586e4e16be26b652b90e3 (diff)
downloadchromium_src-56f959eee5652b24c3ea5efcb243fc999cd4a6a8.zip
chromium_src-56f959eee5652b24c3ea5efcb243fc999cd4a6a8.tar.gz
chromium_src-56f959eee5652b24c3ea5efcb243fc999cd4a6a8.tar.bz2
Remove unused "show title" functionality in UrlPicker.
BUG=none TEST=none Review URL: http://codereview.chromium.org/596063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/options/general_page_view.cc2
-rw-r--r--chrome/browser/views/url_picker.cc85
-rw-r--r--chrome/browser/views/url_picker.h26
3 files changed, 10 insertions, 103 deletions
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index ce8bc00..fd3d589 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -899,7 +899,7 @@ void GeneralPageView::SaveStartupPref() {
}
void GeneralPageView::AddURLToStartupURLs() {
- UrlPicker* dialog = new UrlPicker(this, profile(), false);
+ UrlPicker* dialog = new UrlPicker(this, profile());
dialog->Show(GetWindow()->GetNativeWindow());
}
diff --git a/chrome/browser/views/url_picker.cc b/chrome/browser/views/url_picker.cc
index 190411d..d505e9c 100644
--- a/chrome/browser/views/url_picker.cc
+++ b/chrome/browser/views/url_picker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -44,10 +44,8 @@ UrlPickerDelegate::~UrlPickerDelegate() {}
//
////////////////////////////////////////////////////////////////////////////////
UrlPicker::UrlPicker(UrlPickerDelegate* delegate,
- Profile* profile,
- bool show_title)
+ Profile* profile)
: profile_(profile),
- expected_title_handle_(0),
delegate_(delegate) {
DCHECK(profile_);
@@ -88,22 +86,6 @@ UrlPicker::UrlPicker(UrlPickerDelegate* delegate,
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
GridLayout::FIXED, kTableWidth, 0);
- if (show_title) {
- layout->StartRow(0, labels_column_set_id);
- views::Label* title_label = new views::Label();
- title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- title_label->SetText(l10n_util::GetString(IDS_ASI_TITLE_LABEL));
- layout->AddView(title_label);
-
- title_field_ = new views::Textfield();
- title_field_->SetController(this);
- layout->AddView(title_field_);
-
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
- } else {
- title_field_ = NULL;
- }
-
layout->StartRow(0, labels_column_set_id);
views::Label* url_label = new views::Label();
url_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -141,14 +123,8 @@ UrlPicker::~UrlPicker() {
void UrlPicker::Show(HWND parent) {
DCHECK(!window());
views::Window::CreateChromeWindow(parent, gfx::Rect(), this)->Show();
- if (title_field_) {
- title_field_->SetText(l10n_util::GetString(IDS_ASI_DEFAULT_TITLE));
- title_field_->SelectAll();
- title_field_->RequestFocus();
- } else {
- url_field_->SelectAll();
- url_field_->RequestFocus();
- }
+ url_field_->SelectAll();
+ url_field_->RequestFocus();
url_table_model_->Reload(profile_);
}
@@ -172,47 +148,8 @@ std::wstring UrlPicker::GetDialogButtonLabel(
return std::wstring();
}
-void UrlPicker::OnURLInfoAvailable(
- HistoryService::Handle handle,
- bool success,
- const history::URLRow* info,
- history::VisitVector* unused) {
- if (handle != expected_title_handle_)
- return;
-
- std::wstring s;
- if (success)
- s = info->title();
- if (s.empty())
- s = l10n_util::GetString(IDS_ASI_DEFAULT_TITLE);
-
- if (title_field_) {
- // expected_title_handle_ is reset if the title Textfield is edited so we
- // can safely set the value.
- title_field_->SetText(s);
- title_field_->SelectAll();
- }
- expected_title_handle_ = 0;
-}
-
-void UrlPicker::InitiateTitleAutoFill(const GURL& url) {
- HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
- if (!hs)
- return;
-
- if (expected_title_handle_)
- hs->CancelRequest(expected_title_handle_);
-
- expected_title_handle_ = hs->QueryURL(url, false, &history_consumer_,
- NewCallback(this, &UrlPicker::OnURLInfoAvailable));
-}
-
void UrlPicker::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
- // If the user has edited the title field we no longer want to autofill it
- // so we reset the expected handle to an impossible value.
- if (sender == title_field_)
- expected_title_handle_ = 0;
GetDialogClientView()->UpdateDialogButtons();
}
@@ -220,8 +157,6 @@ bool UrlPicker::Accept() {
if (!IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) {
if (!GetInputURL().is_valid())
url_field_->RequestFocus();
- else if (title_field_)
- title_field_->RequestFocus();
return false;
}
PerformModelChange();
@@ -248,9 +183,7 @@ views::View* UrlPicker::GetContentsView() {
void UrlPicker::PerformModelChange() {
DCHECK(delegate_);
GURL url(GetInputURL());
- const std::wstring title =
- title_field_ ? title_field_->text() : std::wstring();
- delegate_->AddBookmark(this, title, url);
+ delegate_->AddBookmark(this, std::wstring(), url);
}
gfx::Size UrlPicker::GetPreferredSize() {
@@ -278,9 +211,6 @@ bool UrlPicker::AcceleratorPressed(
} else {
url_field_->SelectAll();
}
- } else if (title_field_ && fm->GetFocusedView() == title_field_) {
- url_field_->SelectAll();
- url_field_->RequestFocus();
}
}
return true;
@@ -296,8 +226,6 @@ void UrlPicker::OnSelectionChanged() {
std::wstring formatted = net::FormatUrl(url_table_model_->GetURL(selection),
languages, false, UnescapeRule::NONE, NULL, NULL, NULL);
url_field_->SetText(formatted);
- if (title_field_)
- title_field_->SetText(url_table_model_->GetTitle(selection));
GetDialogClientView()->UpdateDialogButtons();
}
}
@@ -313,5 +241,6 @@ void UrlPicker::OnDoubleClick() {
}
GURL UrlPicker::GetInputURL() const {
- return GURL(URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()), ""));
+ return GURL(URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()),
+ std::string()));
}
diff --git a/chrome/browser/views/url_picker.h b/chrome/browser/views/url_picker.h
index 13376ba..14975e2 100644
--- a/chrome/browser/views/url_picker.h
+++ b/chrome/browser/views/url_picker.h
@@ -1,12 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
#ifndef CHROME_BROWSER_VIEWS_URL_PICKER_H_
#define CHROME_BROWSER_VIEWS_URL_PICKER_H_
-#include "chrome/browser/cancelable_request.h"
-#include "chrome/browser/history/history.h"
#include "views/controls/button/native_button.h"
#include "views/controls/table/table_view_observer.h"
#include "views/controls/textfield/textfield.h"
@@ -47,8 +45,7 @@ class UrlPicker : public views::View,
public views::TableViewObserver {
public:
UrlPicker(UrlPickerDelegate* delegate,
- Profile* profile,
- bool show_title);
+ Profile* profile);
virtual ~UrlPicker();
// Show the dialog on the provided contents.
@@ -88,16 +85,6 @@ class UrlPicker : public views::View,
// Modify the model from the user interface.
void PerformModelChange();
- // Fetch the title for the entered URL. If we get the title in time before
- // the user starts to modify the title field, the title field is changed.
- void InitiateTitleAutoFill(const GURL& url);
-
- // Invoked by the history system when a title becomes available.
- void OnURLInfoAvailable(HistoryService::Handle handle,
- bool success,
- const history::URLRow* info,
- history::VisitVector* unused);
-
// Returns the URL the user has typed.
GURL GetInputURL() const;
@@ -107,21 +94,12 @@ class UrlPicker : public views::View,
// URL Field.
views::Textfield* url_field_;
- // Title field. This is NULL if we're not showing the title.
- views::Textfield* title_field_;
-
// The table model.
scoped_ptr<PossibleURLModel> url_table_model_;
// The table of visited urls.
views::TableView* url_table_;
- // Handle of the title request we are expecting.
- CancelableRequestProvider::Handle expected_title_handle_;
-
- // The consumer object for the history database.
- CancelableRequestConsumer history_consumer_;
-
// The delegate.
UrlPickerDelegate* delegate_;