summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/app_controller_mac.mm2
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc37
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h19
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_unittest.cc13
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc13
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm11
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc2
-rw-r--r--chrome/browser/background_mode_manager.cc4
-rw-r--r--chrome/browser/browser_browsertest.cc8
-rw-r--r--chrome/browser/extensions/extension_management_api.cc3
-rw-r--r--chrome/browser/extensions/extension_omnibox_api.cc17
-rw-r--r--chrome/browser/extensions/extension_omnibox_api.h13
-rw-r--r--chrome/browser/ui/browser.cc14
-rw-r--r--chrome/browser/ui/browser.h14
-rw-r--r--chrome/browser/ui/browser_init.cc9
-rw-r--r--chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h112
-rw-r--r--chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm17
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc71
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h101
-rw-r--r--chrome/browser/ui/omnibox/omnibox_view.h21
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc11
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.cc17
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.h12
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_win.cc17
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_win.h97
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc8
26 files changed, 344 insertions, 319 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index fb01b87..bb7d1ca 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -884,7 +884,7 @@ void RecordLastRunAppBundlePath() {
browser = BrowserList::GetLastActive();
}
const Extension* extension = applications.GetExtension(tag);
- browser->OpenApplicationTab(profile, extension, NULL);
+ browser->OpenApplicationTab(profile, extension, NEW_FOREGROUND_TAB);
}
// Same as |-commandDispatch:|, but executes commands using a disposition
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 7b26b1c..4fce90c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -77,7 +77,6 @@ AutocompleteEditModel::AutocompleteEditModel(
paste_state_(NONE),
control_key_state_(UP),
is_keyword_hint_(false),
- paste_and_go_transition_(PageTransition::TYPED),
profile_(profile),
update_instant_(true),
allow_exact_keyword_match_(false),
@@ -412,12 +411,9 @@ bool AutocompleteEditModel::CanPasteAndGo(const string16& text) const {
if (!view_->GetCommandUpdater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL))
return false;
- AutocompleteMatch match;
profile_->GetAutocompleteClassifier()->Classify(text, string16(), false,
- &match, &paste_and_go_alternate_nav_url_);
- paste_and_go_url_ = match.destination_url;
- paste_and_go_transition_ = match.transition;
- return paste_and_go_url_.is_valid();
+ &paste_and_go_match_, &paste_and_go_alternate_nav_url_);
+ return paste_and_go_match_.destination_url.is_valid();
}
void AutocompleteEditModel::PasteAndGo() {
@@ -425,7 +421,7 @@ void AutocompleteEditModel::PasteAndGo() {
// possible to "paste and go" a string that contains a keyword. This is
// enough of an edge case that we ignore this possibility.
view_->RevertAll();
- view_->OpenURL(paste_and_go_url_, CURRENT_TAB, paste_and_go_transition_,
+ view_->OpenMatch(paste_and_go_match_, CURRENT_TAB,
paste_and_go_alternate_nav_url_, AutocompletePopupModel::kNoMatch,
string16());
}
@@ -475,17 +471,17 @@ void AutocompleteEditModel::AcceptInput(WindowOpenDisposition disposition,
#endif
}
}
- view_->OpenURL(match.destination_url, disposition, match.transition,
- alternate_nav_url, AutocompletePopupModel::kNoMatch,
- is_keyword_hint_ ? string16() : keyword_);
+
+ view_->OpenMatch(match, disposition, alternate_nav_url,
+ AutocompletePopupModel::kNoMatch,
+ is_keyword_hint_ ? string16() : keyword_);
}
-void AutocompleteEditModel::OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t index,
- const string16& keyword) {
+void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t index,
+ const string16& keyword) {
// We only care about cases where there is a selection (i.e. the popup is
// open).
if (popup_->IsOpen()) {
@@ -538,8 +534,13 @@ void AutocompleteEditModel::OpenURL(const GURL& url,
update_instant_ = false;
view_->RevertAll(); // Revert the box to its unedited state
}
- controller_->OnAutocompleteAccept(url, disposition, transition,
- alternate_nav_url);
+
+ if (match.type == AutocompleteMatch::EXTENSION_APP) {
+ LaunchAppFromOmnibox(match, profile_, disposition);
+ } else {
+ controller_->OnAutocompleteAccept(match.destination_url, disposition,
+ match.transition, alternate_nav_url);
+ }
InstantController* instant = controller_->GetInstant();
if (instant && !popup_->IsOpen())
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 3b40f7b..9d3f8b8 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -230,13 +230,10 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate {
// Navigates to the destination last supplied to CanPasteAndGo.
void PasteAndGo();
- // Returns the url set by way of CanPasteAndGo.
- const GURL& paste_and_go_url() const { return paste_and_go_url_; }
-
// Returns true if this is a paste-and-search rather than paste-and-go (or
// nothing).
bool is_paste_and_search() const {
- return (paste_and_go_transition_ != PageTransition::TYPED);
+ return (paste_and_go_match_.transition != PageTransition::TYPED);
}
// Asks the browser to load the popup's currently selected item, using the
@@ -248,12 +245,11 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate {
bool for_drop);
// Asks the browser to load the item at |index|, with the given properties.
- void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t index,
- const string16& keyword);
+ void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t index,
+ const string16& keyword);
bool has_focus() const { return has_focus_; }
@@ -528,8 +524,7 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate {
bool is_keyword_hint_;
// Paste And Go-related state. See CanPasteAndGo().
- mutable GURL paste_and_go_url_;
- mutable PageTransition::Type paste_and_go_transition_;
+ mutable AutocompleteMatch paste_and_go_match_;
mutable GURL paste_and_go_alternate_nav_url_;
Profile* profile_;
diff --git a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
index d6b9844..423a230 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
@@ -20,12 +20,11 @@ class TestingOmniboxView : public OmniboxView {
virtual const AutocompleteEditModel* model() const { return NULL; }
virtual void SaveStateToTab(TabContents* tab) {}
virtual void Update(const TabContents* tab_for_state_restoring) {}
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) {}
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) {}
virtual string16 GetText() const { return string16(); }
virtual bool IsEditingOrEmpty() const { return true; }
virtual int GetIcon() const { return 0; }
@@ -94,7 +93,7 @@ class TestingAutocompleteEditController : public AutocompleteEditController {
DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditController);
};
-}
+} // namespace
typedef testing::Test AutocompleteEditTest;
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index e32a05a..7b475d3 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -472,15 +472,14 @@ size_t AutocompletePopupViewGtk::LineFromY(int y) {
void AutocompletePopupViewGtk::AcceptLine(size_t line,
WindowOpenDisposition disposition) {
- const AutocompleteMatch& match = model_->result().match_at(line);
- // OpenURL() may close the popup, which will clear the result set and, by
- // extension, |match| and its contents. So copy the relevant strings out to
- // make sure they stay alive until the call completes.
- const GURL url(match.destination_url);
+ // OpenMatch() may close the popup, which will clear the result set and, by
+ // extension, |match| and its contents. So copy the relevant match out to
+ // make sure it stays alive until the call completes.
+ AutocompleteMatch match = model_->result().match_at(line);
string16 keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
- omnibox_view_->OpenURL(url, disposition, match.transition, GURL(), line,
- is_keyword_hint ? string16() : keyword);
+ omnibox_view_->OpenMatch(match, disposition, GURL(), line,
+ is_keyword_hint ? string16() : keyword);
}
GdkPixbuf* AutocompletePopupViewGtk::IconForMatch(
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index f1d8b79..83eed6e 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -539,16 +539,15 @@ void AutocompletePopupViewMac::OpenURLForRow(int row, bool force_background) {
event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
}
- // OpenURL() may close the popup, which will clear the result set
+ // OpenMatch() may close the popup, which will clear the result set
// and, by extension, |match| and its contents. So copy the
- // relevant strings out to make sure they stay alive until the call
+ // relevant match out to make sure it stays alive until the call
// completes.
- const AutocompleteMatch& match = model_->result().match_at(row);
- const GURL url(match.destination_url);
+ AutocompleteMatch match = model_->result().match_at(row);
string16 keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
- omnibox_view_->OpenURL(url, disposition, match.transition, GURL(), row,
- is_keyword_hint ? string16() : keyword);
+ omnibox_view_->OpenMatch(match, disposition, GURL(), row,
+ is_keyword_hint ? string16() : keyword);
}
void AutocompletePopupViewMac::UserPressedOptIn(bool opt_in) {
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index f004104..fd421ab 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5141,7 +5141,7 @@ void TestingAutomationProvider::LaunchApp(
new AppLaunchObserver(&old_contents->controller(), this, reply_message,
launch_container);
Browser::OpenApplication(profile(), extension, launch_container,
- old_contents);
+ CURRENT_TAB);
}
// Sample JSON input: { "command": "SetAppLaunchType",
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc
index 178f4c3..c69d57f 100644
--- a/chrome/browser/background_mode_manager.cc
+++ b/chrome/browser/background_mode_manager.cc
@@ -319,7 +319,7 @@ void BackgroundModeManager::RemoveStatusTrayIcon() {
if (status_icon_)
status_tray_->RemoveStatusIcon(status_icon_);
status_icon_ = NULL;
- context_menu_ = NULL; // Do not delete, points within status_icon_
+ context_menu_ = NULL; // Do not delete, points within |status_icon_|.
}
void BackgroundModeManager::ExecuteApplication(int item) {
@@ -330,7 +330,7 @@ void BackgroundModeManager::ExecuteApplication(int item) {
browser = BrowserList::GetLastActive();
}
const Extension* extension = applications_.GetExtension(item);
- browser->OpenApplicationTab(profile_, extension, NULL);
+ browser->OpenApplicationTab(profile_, extension, NEW_FOREGROUND_TAB);
}
void BackgroundModeManager::ExecuteCommand(int item) {
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index 545d427..26172ee 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -580,7 +580,6 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
ASSERT_NE(
new_browser->app_name_.find(extension_app->id()),
std::string::npos) << new_browser->app_name_;
-
}
#endif
@@ -728,8 +727,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) {
const Extension* extension_app = GetExtension();
// Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would.
- TabContents* app_window = Browser::OpenApplication(
- browser()->profile(), extension_app, extension_misc::LAUNCH_WINDOW, NULL);
+ TabContents* app_window =
+ Browser::OpenApplication(browser()->profile(),
+ extension_app,
+ extension_misc::LAUNCH_WINDOW,
+ NEW_WINDOW);
ASSERT_TRUE(app_window);
// Apps launched in a window from the NTP do not have extension_app set in
diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc
index 62879c4..83a9e43 100644
--- a/chrome/browser/extensions/extension_management_api.cc
+++ b/chrome/browser/extensions/extension_management_api.cc
@@ -184,7 +184,8 @@ bool LaunchAppFunction::RunImpl() {
extension_misc::LaunchContainer launch_container =
service()->extension_prefs()->GetLaunchContainer(
extension, ExtensionPrefs::LAUNCH_DEFAULT);
- Browser::OpenApplication(profile(), extension, launch_container, NULL);
+ Browser::OpenApplication(profile(), extension, launch_container,
+ NEW_FOREGROUND_TAB);
UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
extension_misc::APP_LAUNCH_EXTENSION_API,
extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
diff --git a/chrome/browser/extensions/extension_omnibox_api.cc b/chrome/browser/extensions/extension_omnibox_api.cc
index 228aaa6..1d8a2cc 100644
--- a/chrome/browser/extensions/extension_omnibox_api.cc
+++ b/chrome/browser/extensions/extension_omnibox_api.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/browser/ui/browser.h"
#include "content/common/notification_service.h"
namespace events {
@@ -263,3 +264,19 @@ void ApplyDefaultSuggestionForExtensionKeyword(
match->contents.assign(description);
}
+
+void LaunchAppFromOmnibox(const AutocompleteMatch& match,
+ Profile* profile,
+ WindowOpenDisposition disposition) {
+ ExtensionService* service = profile->GetExtensionService();
+ const Extension* extension =
+ service->GetExtensionById(match.destination_url.host(), false);
+
+ // Look at the preferences to find the right launch container. If no
+ // preference is set, launch as a regular tab.
+ extension_misc::LaunchContainer launch_container =
+ service->extension_prefs()->GetLaunchContainer(
+ extension, ExtensionPrefs::LAUNCH_REGULAR);
+
+ Browser::OpenApplication(profile, extension, launch_container, disposition);
+}
diff --git a/chrome/browser/extensions/extension_omnibox_api.h b/chrome/browser/extensions/extension_omnibox_api.h
index 61a2f89..b7b0b02 100644
--- a/chrome/browser/extensions/extension_omnibox_api.h
+++ b/chrome/browser/extensions/extension_omnibox_api.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,9 +6,13 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_
#pragma once
+#include <string>
+#include <vector>
+
#include "base/string16.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/extensions/extension_function.h"
+#include "webkit/glue/window_open_disposition.h"
// Event router class for events related to the omnibox API.
class ExtensionOmniboxEventRouter {
@@ -89,4 +93,11 @@ void ApplyDefaultSuggestionForExtensionKeyword(
const string16& remaining_input,
AutocompleteMatch* match);
+// Launch an Extension App from |match| details provided by the Omnibox. If the
+// application wants to launch as a window or panel, |disposition| is ignored;
+// otherwise it's used to determine in which tab we'll launch the application.
+void LaunchAppFromOmnibox(const AutocompleteMatch& match,
+ Profile* profile,
+ WindowOpenDisposition disposition);
+
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 23e9d6f..317c89b 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -523,7 +523,7 @@ TabContents* Browser::OpenApplication(
Profile* profile,
const Extension* extension,
extension_misc::LaunchContainer container,
- TabContents* existing_tab) {
+ WindowOpenDisposition disposition) {
TabContents* tab = NULL;
ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs();
prefs->SetActiveBit(extension->id(), true);
@@ -537,7 +537,7 @@ TabContents* Browser::OpenApplication(
GURL(), NULL);
break;
case extension_misc::LAUNCH_TAB: {
- tab = Browser::OpenApplicationTab(profile, extension, existing_tab);
+ tab = Browser::OpenApplicationTab(profile, extension, disposition);
break;
}
default:
@@ -627,7 +627,7 @@ TabContents* Browser::OpenAppShortcutWindow(Profile* profile,
// static
TabContents* Browser::OpenApplicationTab(Profile* profile,
const Extension* extension,
- TabContents* existing_tab) {
+ WindowOpenDisposition disposition) {
Browser* browser = BrowserList::FindTabbedBrowser(profile, false);
TabContents* contents = NULL;
if (!browser)
@@ -658,14 +658,15 @@ TabContents* Browser::OpenApplicationTab(Profile* profile,
browser::NavigateParams params(browser, extension_url,
PageTransition::START_PAGE);
params.tabstrip_add_types = add_type;
+ params.disposition = disposition;
- // Launch the application in the existing TabContents, if it was supplied.
- if (existing_tab) {
+ if (disposition == CURRENT_TAB) {
+ TabContents* existing_tab = browser->GetSelectedTabContents();
TabStripModel* model = browser->tabstrip_model();
int tab_index = model->GetWrapperIndex(existing_tab);
existing_tab->OpenURL(extension->GetFullLaunchURL(), existing_tab->GetURL(),
- CURRENT_TAB, PageTransition::LINK);
+ disposition, PageTransition::LINK);
if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
model->SetTabPinned(tab_index, true);
tab_index = model->GetWrapperIndex(existing_tab);
@@ -675,7 +676,6 @@ TabContents* Browser::OpenApplicationTab(Profile* profile,
contents = existing_tab;
} else {
- params.disposition = NEW_FOREGROUND_TAB;
browser::Navigate(&params);
contents = params.target_contents->tab_contents();
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index aadb6b2..7111933 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -234,14 +234,13 @@ class Browser : public TabHandlerDelegate,
// |profile|, that session is re-used.
static void OpenURLOffTheRecord(Profile* profile, const GURL& url);
- // Open |extension| in |container|, using |existing_tab| if not NULL and if
- // the correct container type. Returns the TabContents* that was created or
- // NULL.
+ // Open |extension| in |container|, using |disposition| if container type is
+ // TAB. Returns the TabContents* that was created or NULL.
static TabContents* OpenApplication(
Profile* profile,
const Extension* extension,
extension_misc::LaunchContainer container,
- TabContents* existing_tab);
+ WindowOpenDisposition disposition);
// Opens a new application window for the specified url. If |as_panel|
// is true, the application will be opened as a Browser::Type::APP_PANEL in
@@ -267,12 +266,11 @@ class Browser : public TabHandlerDelegate,
const GURL& url,
bool update_shortcut);
- // Open an application for |extension| in a new application tab, or
- // |existing_tab| if not NULL. Returns NULL if there are no appropriate
- // existing browser windows for |profile|.
+ // Open an application for |extension| using |disposition|. Returns NULL if
+ // there are no appropriate existing browser windows for |profile|.
static TabContents* OpenApplicationTab(Profile* profile,
const Extension* extension,
- TabContents* existing_tab);
+ WindowOpenDisposition disposition);
// Opens a new window and opens the bookmark manager.
static void OpenBookmarkManagerWindow(Profile* profile);
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 71c61f0..16c8b4e 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -768,7 +768,8 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationTab(Profile* profile) {
RecordCmdLineAppHistogram();
- TabContents* app_tab = Browser::OpenApplicationTab(profile, extension, NULL);
+ TabContents* app_tab = Browser::OpenApplicationTab(profile, extension,
+ NEW_FOREGROUND_TAB);
return (app_tab != NULL);
}
@@ -796,7 +797,7 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
RecordCmdLineAppHistogram();
TabContents* tab_in_app_window = Browser::OpenApplication(
- profile, extension, launch_container, NULL);
+ profile, extension, launch_container, NEW_WINDOW);
return (tab_in_app_window != NULL);
}
@@ -1080,10 +1081,10 @@ class DNSCertProvenanceCheckingInfoBar : public ConfirmInfoBarDelegate {
virtual bool Accept() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(DNSCertProvenanceCheckingInfoBar);
-
static const char kLearnMoreURL[];
TabContents* const tab_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(DNSCertProvenanceCheckingInfoBar);
};
DNSCertProvenanceCheckingInfoBar::DNSCertProvenanceCheckingInfoBar(
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h
index 6b51ee5..6ee0d4c 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
+#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
@@ -35,77 +36,78 @@ class OmniboxViewMac : public OmniboxView,
virtual ~OmniboxViewMac();
// OmniboxView:
- virtual AutocompleteEditModel* model();
- virtual const AutocompleteEditModel* model() const;
+ virtual AutocompleteEditModel* model() OVERRIDE;
+ virtual const AutocompleteEditModel* model() const OVERRIDE;
- virtual void SaveStateToTab(TabContents* tab);
- virtual void Update(const TabContents* tab_for_state_restoring);
+ virtual void SaveStateToTab(TabContents* tab) OVERRIDE;
+ virtual void Update(const TabContents* tab_for_state_restoring) OVERRIDE;
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword);
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t index,
+ const string16& keyword) OVERRIDE;
- virtual string16 GetText() const;
+ virtual string16 GetText() const OVERRIDE;
- virtual bool IsEditingOrEmpty() const;
- virtual int GetIcon() const;
+ virtual bool IsEditingOrEmpty() const OVERRIDE;
+ virtual int GetIcon() const OVERRIDE;
- virtual void SetUserText(const string16& text);
+ virtual void SetUserText(const string16& text) OVERRIDE;
virtual void SetUserText(const string16& text,
const string16& display_text,
- bool update_popup);
+ bool update_popup) OVERRIDE;
virtual void SetWindowTextAndCaretPos(const string16& text,
- size_t caret_pos);
+ size_t caret_pos) OVERRIDE;
- virtual void SetForcedQuery();
+ virtual void SetForcedQuery() OVERRIDE;
- virtual bool IsSelectAll();
- virtual bool DeleteAtEndPressed();
+ virtual bool IsSelectAll() OVERRIDE;
+ virtual bool DeleteAtEndPressed() OVERRIDE;
virtual void GetSelectionBounds(string16::size_type* start,
- string16::size_type* end);
-
- virtual void SelectAll(bool reversed);
- virtual void RevertAll();
- virtual void UpdatePopup();
- virtual void ClosePopup();
- virtual void SetFocus();
- virtual void OnTemporaryTextMaybeChanged(const string16& display_text,
- bool save_original_selection);
+ string16::size_type* end) OVERRIDE;
+
+ virtual void SelectAll(bool reversed) OVERRIDE;
+ virtual void RevertAll() OVERRIDE;
+ virtual void UpdatePopup() OVERRIDE;
+ virtual void ClosePopup() OVERRIDE;
+ virtual void SetFocus() OVERRIDE;
+ virtual void OnTemporaryTextMaybeChanged(
+ const string16& display_text,
+ bool save_original_selection) OVERRIDE;
virtual bool OnInlineAutocompleteTextMaybeChanged(
- const string16& display_text, size_t user_text_length);
- virtual void OnStartingIME();
- virtual void OnRevertTemporaryText();
- virtual void OnBeforePossibleChange();
- virtual bool OnAfterPossibleChange();
- virtual gfx::NativeView GetNativeView() const;
- virtual CommandUpdater* GetCommandUpdater();
+ const string16& display_text, size_t user_text_length) OVERRIDE;
+ virtual void OnStartingIME() OVERRIDE;
+ virtual void OnRevertTemporaryText() OVERRIDE;
+ virtual void OnBeforePossibleChange() OVERRIDE;
+ virtual bool OnAfterPossibleChange() OVERRIDE;
+ virtual gfx::NativeView GetNativeView() const OVERRIDE;
+ virtual CommandUpdater* GetCommandUpdater() OVERRIDE;
virtual void SetInstantSuggestion(const string16& input,
- bool animate_to_complete);
- virtual string16 GetInstantSuggestion() const;
- virtual int TextWidth() const;
- virtual bool IsImeComposing() const;
+ bool animate_to_complete) OVERRIDE;
+ virtual string16 GetInstantSuggestion() const OVERRIDE;
+ virtual int TextWidth() const OVERRIDE;
+ virtual bool IsImeComposing() const OVERRIDE;
// Implement the AutocompleteTextFieldObserver interface.
- virtual NSRange SelectionRangeForProposedRange(NSRange proposed_range);
- virtual void OnControlKeyChanged(bool pressed);
- virtual bool CanCopy();
- virtual void CopyToPasteboard(NSPasteboard* pboard);
- virtual void OnPaste();
- virtual bool CanPasteAndGo();
- virtual int GetPasteActionStringId();
- virtual void OnPasteAndGo();
- virtual void OnFrameChanged();
- virtual void OnDidBeginEditing();
- virtual void OnBeforeChange();
- virtual void OnDidChange();
- virtual void OnDidEndEditing();
- virtual bool OnDoCommandBySelector(SEL cmd);
- virtual void OnSetFocus(bool control_down);
- virtual void OnKillFocus();
+ virtual NSRange SelectionRangeForProposedRange(
+ NSRange proposed_range) OVERRIDE;
+ virtual void OnControlKeyChanged(bool pressed) OVERRIDE;
+ virtual bool CanCopy() OVERRIDE;
+ virtual void CopyToPasteboard(NSPasteboard* pboard) OVERRIDE;
+ virtual void OnPaste() OVERRIDE;
+ virtual bool CanPasteAndGo() OVERRIDE;
+ virtual int GetPasteActionStringId() OVERRIDE;
+ virtual void OnPasteAndGo() OVERRIDE;
+ virtual void OnFrameChanged() OVERRIDE;
+ virtual void OnDidBeginEditing() OVERRIDE;
+ virtual void OnBeforeChange() OVERRIDE;
+ virtual void OnDidChange() OVERRIDE;
+ virtual void OnDidEndEditing() OVERRIDE;
+ virtual bool OnDoCommandBySelector(SEL cmd) OVERRIDE;
+ virtual void OnSetFocus(bool control_down) OVERRIDE;
+ virtual void OnKillFocus() OVERRIDE;
// Helper for LocationBarViewMac. Optionally selects all in |field_|.
void FocusLocation(bool select_all);
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index 2db3d58..fc95d7e 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -287,21 +287,20 @@ void OmniboxViewMac::Update(const TabContents* tab_for_state_restoring) {
}
}
-void OmniboxViewMac::OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) {
+void OmniboxViewMac::OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) {
// TODO(shess): Why is the caller passing an invalid url in the
// first place? Make sure that case isn't being dropped on the
// floor.
- if (!url.is_valid()) {
+ if (!match.destination_url.is_valid()) {
return;
}
- model_->OpenURL(url, disposition, transition, alternate_nav_url,
- selected_line, keyword);
+ model_->OpenMatch(match, disposition, alternate_nav_url,
+ selected_line, keyword);
}
string16 OmniboxViewMac::GetText() const {
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
index 0c3dcca..ec2f4b5 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
@@ -199,7 +199,7 @@ OmniboxViewGtk::OmniboxViewGtk(
content_maybe_changed_by_key_press_(false),
update_popup_without_focus_(false),
#if GTK_CHECK_VERSION(2, 20, 0)
- preedit_size_before_change_(0),
+ pre_edit_size_before_change_(0),
#endif
going_to_focus_(NULL) {
popup_view_.reset(
@@ -346,7 +346,7 @@ void OmniboxViewGtk::Init() {
G_CALLBACK(&HandleHierarchyChangedThunk), this);
#if GTK_CHECK_VERSION(2, 20, 0)
g_signal_connect(text_view_, "preedit-changed",
- G_CALLBACK(&HandlePreeditChangedThunk), this);
+ G_CALLBACK(&HandlePreEditChangedThunk), this);
#endif
g_signal_connect(text_view_, "undo", G_CALLBACK(&HandleUndoRedoThunk), this);
g_signal_connect(text_view_, "redo", G_CALLBACK(&HandleUndoRedoThunk), this);
@@ -368,8 +368,8 @@ void OmniboxViewGtk::Init() {
// Insert a Zero Width Space character just before the instant anchor.
// It's a hack to workaround a bug of GtkTextView which can not align the
- // preedit string and a child anchor correctly when there is no other content
- // around the preedit string.
+ // pre-edit string and a child anchor correctly when there is no other content
+ // around the pre-edit string.
gtk_text_buffer_insert(text_buffer_, &end_iter, "\342\200\213", -1);
GtkTextChildAnchor* instant_anchor =
gtk_text_buffer_create_child_anchor(text_buffer_, &end_iter);
@@ -494,17 +494,16 @@ void OmniboxViewGtk::Update(const TabContents* contents) {
}
}
-void OmniboxViewGtk::OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) {
- if (!url.is_valid())
+void OmniboxViewGtk::OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) {
+ if (!match.destination_url.is_valid())
return;
- model_->OpenURL(url, disposition, transition, alternate_nav_url,
- selected_line, keyword);
+ model_->OpenMatch(match, disposition, alternate_nav_url,
+ selected_line, keyword);
}
string16 OmniboxViewGtk::GetText() const {
@@ -518,10 +517,10 @@ string16 OmniboxViewGtk::GetText() const {
// We need to treat the text currently being composed by the input method as
// part of the text content, so that omnibox can work correctly in the middle
// of composition.
- if (preedit_.size()) {
+ if (pre_edit_.size()) {
GtkTextMark* mark = gtk_text_buffer_get_insert(text_buffer_);
gtk_text_buffer_get_iter_at_mark(text_buffer_, &start, mark);
- out.insert(gtk_text_iter_get_offset(&start), preedit_);
+ out.insert(gtk_text_iter_get_offset(&start), pre_edit_);
}
#endif
return out;
@@ -673,7 +672,7 @@ void OmniboxViewGtk::OnBeforePossibleChange() {
text_before_change_ = GetText();
sel_before_change_ = GetSelection();
#if GTK_CHECK_VERSION(2, 20, 0)
- preedit_size_before_change_ = preedit_.size();
+ pre_edit_size_before_change_ = pre_edit_.size();
#endif
}
@@ -713,7 +712,7 @@ bool OmniboxViewGtk::OnAfterPossibleChange() {
text_changed_ = (new_text != text_before_change_);
#if GTK_CHECK_VERSION(2, 20, 0)
text_changed_ =
- text_changed_ || (preedit_.size() != preedit_size_before_change_);
+ text_changed_ || (pre_edit_.size() != pre_edit_size_before_change_);
#endif
if (text_changed_)
@@ -775,7 +774,7 @@ void OmniboxViewGtk::SetInstantSuggestion(const string16& suggestion,
}
if (animate_to_complete
#if GTK_CHECK_VERSION(2, 20, 0)
- && preedit_.empty()
+ && pre_edit_.empty()
#endif
) {
instant_animation_->set_delegate(this);
@@ -839,7 +838,7 @@ int OmniboxViewGtk::TextWidth() const {
bool OmniboxViewGtk::IsImeComposing() const {
#if GTK_CHECK_VERSION(2, 20, 0)
- return !preedit_.empty();
+ return !pre_edit_.empty();
#else
return false;
#endif
@@ -1695,7 +1694,7 @@ void OmniboxViewGtk::HandleViewMoveFocus(GtkWidget* widget,
handled = model_->AcceptKeyword();
#if GTK_CHECK_VERSION(2, 20, 0)
- if (!handled && !preedit_.empty())
+ if (!handled && !pre_edit_.empty())
handled = true;
#endif
@@ -1951,10 +1950,10 @@ OmniboxViewGtk::CharRange OmniboxViewGtk::GetSelection() const {
#if GTK_CHECK_VERSION(2, 20, 0)
// Nothing should be selected when we are in the middle of composition.
- DCHECK(preedit_.empty() || start_offset == end_offset);
- if (!preedit_.empty()) {
- start_offset += preedit_.size();
- end_offset += preedit_.size();
+ DCHECK(pre_edit_.empty() || start_offset == end_offset);
+ if (!pre_edit_.empty()) {
+ start_offset += pre_edit_.size();
+ end_offset += pre_edit_.size();
}
#endif
@@ -1975,7 +1974,7 @@ int OmniboxViewGtk::GetTextLength() const {
#if GTK_CHECK_VERSION(2, 20, 0)
// We need to count the length of the text being composed, because we treat
// it as part of the content in GetText().
- return gtk_text_iter_get_offset(&end) + preedit_.size();
+ return gtk_text_iter_get_offset(&end) + pre_edit_.size();
#else
return gtk_text_iter_get_offset(&end);
#endif
@@ -1995,12 +1994,12 @@ bool OmniboxViewGtk::IsCaretAtEnd() const {
void OmniboxViewGtk::EmphasizeURLComponents() {
#if GTK_CHECK_VERSION(2, 20, 0)
- // We can't change the text style easily, if the preedit string (the text
+ // We can't change the text style easily, if the pre-edit string (the text
// being composed by the input method) is not empty, which is not treated as
// a part of the text content inside GtkTextView. And it's ok to simply return
- // in this case, as this method will be called again when the preedit string
+ // in this case, as this method will be called again when the pre-edit string
// gets committed.
- if (preedit_.size()) {
+ if (pre_edit_.size()) {
strikethrough_ = CharRange();
return;
}
@@ -2276,21 +2275,21 @@ void OmniboxViewGtk::UpdatePrimarySelectionIfValidURL() {
}
#if GTK_CHECK_VERSION(2, 20, 0)
-void OmniboxViewGtk::HandlePreeditChanged(GtkWidget* sender,
- const gchar* preedit) {
+void OmniboxViewGtk::HandlePreEditChanged(GtkWidget* sender,
+ const gchar* pre_edit) {
// GtkTextView won't fire "begin-user-action" and "end-user-action" signals
- // when changing the preedit string, so we need to call
+ // when changing the pre-edit string, so we need to call
// OnBeforePossibleChange() and OnAfterPossibleChange() by ourselves.
OnBeforePossibleChange();
- if (preedit && *preedit) {
+ if (pre_edit && *pre_edit) {
// GtkTextView will only delete the selection range when committing the
- // preedit string, which will cause very strange behavior, so we need to
+ // pre-edit string, which will cause very strange behavior, so we need to
// delete the selection range here explicitly. See http://crbug.com/18808.
- if (preedit_.empty())
+ if (pre_edit_.empty())
gtk_text_buffer_delete_selection(text_buffer_, false, true);
- preedit_ = UTF8ToUTF16(preedit);
+ pre_edit_ = UTF8ToUTF16(pre_edit);
} else {
- preedit_.clear();
+ pre_edit_.clear();
}
OnAfterPossibleChange();
}
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h
index 740fafd..7750f76 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
+#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
@@ -89,65 +90,65 @@ class OmniboxViewGtk : public OmniboxView,
int WidthOfTextAfterCursor();
// OmniboxView:
- virtual AutocompleteEditModel* model();
- virtual const AutocompleteEditModel* model() const;
+ virtual AutocompleteEditModel* model() OVERRIDE;
+ virtual const AutocompleteEditModel* model() const OVERRIDE;
- virtual void SaveStateToTab(TabContents* tab);
+ virtual void SaveStateToTab(TabContents* tab) OVERRIDE;
- virtual void Update(const TabContents* tab_for_state_restoring);
+ virtual void Update(const TabContents* tab_for_state_restoring) OVERRIDE;
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword);
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t index,
+ const string16& keyword) OVERRIDE;
- virtual string16 GetText() const;
+ virtual string16 GetText() const OVERRIDE;
- virtual bool IsEditingOrEmpty() const;
- virtual int GetIcon() const;
+ virtual bool IsEditingOrEmpty() const OVERRIDE;
+ virtual int GetIcon() const OVERRIDE;
- virtual void SetUserText(const string16& text);
+ virtual void SetUserText(const string16& text) OVERRIDE;
virtual void SetUserText(const string16& text,
const string16& display_text,
- bool update_popup);
+ bool update_popup) OVERRIDE;
virtual void SetWindowTextAndCaretPos(const string16& text,
- size_t caret_pos);
+ size_t caret_pos) OVERRIDE;
- virtual void SetForcedQuery();
+ virtual void SetForcedQuery() OVERRIDE;
- virtual bool IsSelectAll();
- virtual bool DeleteAtEndPressed();
+ virtual bool IsSelectAll() OVERRIDE;
+ virtual bool DeleteAtEndPressed() OVERRIDE;
virtual void GetSelectionBounds(string16::size_type* start,
- string16::size_type* end);
- virtual void SelectAll(bool reversed);
- virtual void RevertAll();
+ string16::size_type* end) OVERRIDE;
+ virtual void SelectAll(bool reversed) OVERRIDE;
+ virtual void RevertAll() OVERRIDE;
- virtual void UpdatePopup();
- virtual void ClosePopup();
+ virtual void UpdatePopup() OVERRIDE;
+ virtual void ClosePopup() OVERRIDE;
- virtual void SetFocus();
+ virtual void SetFocus() OVERRIDE;
- virtual void OnTemporaryTextMaybeChanged(const string16& display_text,
- bool save_original_selection);
+ virtual void OnTemporaryTextMaybeChanged(
+ const string16& display_text,
+ bool save_original_selection) OVERRIDE;
virtual bool OnInlineAutocompleteTextMaybeChanged(
- const string16& display_text, size_t user_text_length);
- virtual void OnRevertTemporaryText();
- virtual void OnBeforePossibleChange();
- virtual bool OnAfterPossibleChange();
- virtual gfx::NativeView GetNativeView() const;
- virtual CommandUpdater* GetCommandUpdater();
+ const string16& display_text, size_t user_text_length) OVERRIDE;
+ virtual void OnRevertTemporaryText() OVERRIDE;
+ virtual void OnBeforePossibleChange() OVERRIDE;
+ virtual bool OnAfterPossibleChange() OVERRIDE;
+ virtual gfx::NativeView GetNativeView() const OVERRIDE;
+ virtual CommandUpdater* GetCommandUpdater() OVERRIDE;
virtual void SetInstantSuggestion(const string16& suggestion,
- bool animate_to_complete);
- virtual string16 GetInstantSuggestion() const;
- virtual int TextWidth() const;
- virtual bool IsImeComposing() const;
+ bool animate_to_complete) OVERRIDE;
+ virtual string16 GetInstantSuggestion() const OVERRIDE;
+ virtual int TextWidth() const OVERRIDE;
+ virtual bool IsImeComposing() const OVERRIDE;
#if defined(TOOLKIT_VIEWS)
- virtual views::View* AddToView(views::View* parent);
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
+ virtual views::View* AddToView(views::View* parent) OVERRIDE;
+ virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE;
// A factory method to create an OmniboxView instance initialized for
// linux_views. This currently returns an instance of OmniboxViewGtk only,
@@ -164,12 +165,12 @@ class OmniboxViewGtk : public OmniboxView,
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details) OVERRIDE;
// Overridden from ui::AnimationDelegate.
- virtual void AnimationEnded(const ui::Animation* animation);
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
+ virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
// Sets the colors of the text view according to the theme.
void SetBaseColor();
@@ -243,7 +244,7 @@ class OmniboxViewGtk : public OmniboxView,
CHROMEGTK_CALLBACK_1(OmniboxViewGtk, void, HandleHierarchyChanged,
GtkWidget*);
#if GTK_CHECK_VERSION(2, 20, 0)
- CHROMEGTK_CALLBACK_1(OmniboxViewGtk, void, HandlePreeditChanged,
+ CHROMEGTK_CALLBACK_1(OmniboxViewGtk, void, HandlePreEditChanged,
const gchar*);
#endif
// Undo/redo operations won't trigger "begin-user-action" and
@@ -309,7 +310,7 @@ class OmniboxViewGtk : public OmniboxView,
GtkTextIter* iter_min,
GtkTextIter* iter_max);
- // Return the number of characers in the current buffer.
+ // Return the number of characters in the current buffer.
int GetTextLength() const;
// Places the caret at the given position. This clears any selection.
@@ -515,7 +516,7 @@ class OmniboxViewGtk : public OmniboxView,
// Indicates if omnibox's content maybe changed by a key press event, so that
// we need to call OnAfterPossibleChange() after handling the event.
// This flag should be set for changes directly caused by a key press event,
- // including changes to content text, selection range and preedit string.
+ // including changes to content text, selection range and pre-edit string.
// Changes caused by function calls like SetUserText() should not affect this
// flag.
bool content_maybe_changed_by_key_press_;
@@ -527,11 +528,11 @@ class OmniboxViewGtk : public OmniboxView,
#if GTK_CHECK_VERSION(2, 20, 0)
// Stores the text being composed by the input method.
- string16 preedit_;
+ string16 pre_edit_;
- // Tracking preedit state before and after a possible change. We don't need to
- // track preedit_'s content, as it'll be treated as part of text content.
- size_t preedit_size_before_change_;
+ // Tracking pre-edit state before and after a possible change. We don't need
+ // to track pre-edit_'s content, as it'll be treated as part of text content.
+ size_t pre_edit_size_before_change_;
#endif
// The view that is going to be focused next. Only valid while handling
diff --git a/chrome/browser/ui/omnibox/omnibox_view.h b/chrome/browser/ui/omnibox/omnibox_view.h
index 3f06c92..7a59433 100644
--- a/chrome/browser/ui/omnibox/omnibox_view.h
+++ b/chrome/browser/ui/omnibox/omnibox_view.h
@@ -15,6 +15,7 @@
#include <string>
#include "base/string16.h"
+#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "content/common/page_transition_types.h"
#include "ui/gfx/native_widget_types.h"
#include "webkit/glue/window_open_disposition.h"
@@ -46,22 +47,22 @@ class OmniboxView {
// state we should restore.
virtual void Update(const TabContents* tab_for_state_restoring) = 0;
- // Asks the browser to load the specified URL, which is assumed to be one of
- // the popup entries, using the supplied disposition and transition type.
- // |alternate_nav_url|, if non-empty, contains the alternate navigation URL
- // for |url|. See comments on AutocompleteResult::GetAlternateNavURL().
+ // Asks the browser to load the specified match's |destination_url|, which
+ // is assumed to be one of the popup entries, using the supplied disposition
+ // and transition type. |alternate_nav_url|, if non-empty, contains the
+ // alternate navigation URL for for this match. See comments on
+ // AutocompleteResult::GetAlternateNavURL().
//
// |selected_line| is passed to SendOpenNotification(); see comments there.
//
// If the URL was expanded from a keyword, |keyword| is that keyword.
//
// This may close the popup.
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) = 0;
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) = 0;
// Returns the current text of the edit control, which could be the
// "temporary" text set by the popup, the "permanent" text set by the
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 23d9a0e..d724051 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -620,14 +620,13 @@ void AutocompletePopupContentsView::OpenIndex(
if (!HasMatchAt(index))
return;
- const AutocompleteMatch& match = model_->result().match_at(index);
- // OpenURL() may close the popup, which will clear the result set and, by
- // extension, |match| and its contents. So copy the relevant strings out to
- // make sure they stay alive until the call completes.
- const GURL url(match.destination_url);
+ // OpenMatch() may close the popup, which will clear the result set and, by
+ // extension, |match| and its contents. So copy the relevant match out to
+ // make sure it stays alive until the call completes.
+ AutocompleteMatch match = model_->result().match_at(index);
string16 keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
- omnibox_view_->OpenURL(url, disposition, match.transition, GURL(), index,
+ omnibox_view_->OpenMatch(match, disposition, GURL(), index,
is_keyword_hint ? string16() : keyword);
}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index a3af710..1e590f1 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -316,17 +316,16 @@ void OmniboxViewViews::Update(const TabContents* contents) {
}
}
-void OmniboxViewViews::OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) {
- if (!url.is_valid())
+void OmniboxViewViews::OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) {
+ if (!match.destination_url.is_valid())
return;
- model_->OpenURL(url, disposition, transition, alternate_nav_url,
- selected_line, keyword);
+ model_->OpenMatch(match, disposition, alternate_nav_url,
+ selected_line, keyword);
}
string16 OmniboxViewViews::GetText() const {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h
index 9e0cf6c0..d2583fa 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "content/common/notification_observer.h"
@@ -77,12 +78,11 @@ class OmniboxViewViews : public views::View,
virtual void Update(const TabContents* tab_for_state_restoring) OVERRIDE;
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) OVERRIDE;
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) OVERRIDE;
virtual string16 GetText() const OVERRIDE;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 8274b9d..1096528 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -596,13 +596,12 @@ void OmniboxViewWin::Update(const TabContents* tab_for_state_restoring) {
}
}
-void OmniboxViewWin::OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword) {
- if (!url.is_valid())
+void OmniboxViewWin::OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t selected_line,
+ const string16& keyword) {
+ if (!match.destination_url.is_valid())
return;
// When we navigate, we first revert to the unedited state, then if necessary
@@ -610,8 +609,8 @@ void OmniboxViewWin::OpenURL(const GURL& url,
// here, the user could potentially see a flicker of the current URL before
// the new one reappears, which would look glitchy.
ScopedFreeze freeze(this, GetTextObjectModel());
- model_->OpenURL(url, disposition, transition, alternate_nav_url,
- selected_line, keyword);
+ model_->OpenMatch(match, disposition, alternate_nav_url,
+ selected_line, keyword);
}
string16 OmniboxViewWin::GetText() const {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h
index 3944c60..bbea2ee 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h
@@ -83,64 +83,66 @@ class OmniboxViewWin
gfx::Font GetFont();
// OmniboxView:
- virtual AutocompleteEditModel* model() { return model_.get(); }
- virtual const AutocompleteEditModel* model() const { return model_.get(); }
+ virtual AutocompleteEditModel* model() OVERRIDE { return model_.get(); }
+ virtual const AutocompleteEditModel* model() const OVERRIDE {
+ return model_.get();
+ }
- virtual void SaveStateToTab(TabContents* tab);
+ virtual void SaveStateToTab(TabContents* tab) OVERRIDE;
- virtual void Update(const TabContents* tab_for_state_restoring);
+ virtual void Update(const TabContents* tab_for_state_restoring) OVERRIDE;
- virtual void OpenURL(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url,
- size_t selected_line,
- const string16& keyword);
+ virtual void OpenMatch(const AutocompleteMatch& match,
+ WindowOpenDisposition disposition,
+ const GURL& alternate_nav_url,
+ size_t index,
+ const string16& keyword) OVERRIDE;
- virtual string16 GetText() const;
+ virtual string16 GetText() const OVERRIDE;
- virtual bool IsEditingOrEmpty() const;
- virtual int GetIcon() const;
+ virtual bool IsEditingOrEmpty() const OVERRIDE;
+ virtual int GetIcon() const OVERRIDE;
- virtual void SetUserText(const string16& text);
+ virtual void SetUserText(const string16& text) OVERRIDE;
virtual void SetUserText(const string16& text,
const string16& display_text,
- bool update_popup);
+ bool update_popup) OVERRIDE;
virtual void SetWindowTextAndCaretPos(const string16& text,
- size_t caret_pos);
+ size_t caret_pos) OVERRIDE;
- virtual void SetForcedQuery();
+ virtual void SetForcedQuery() OVERRIDE;
- virtual bool IsSelectAll();
- virtual bool DeleteAtEndPressed();
+ virtual bool IsSelectAll() OVERRIDE;
+ virtual bool DeleteAtEndPressed() OVERRIDE;
virtual void GetSelectionBounds(string16::size_type* start,
- string16::size_type* end);
- virtual void SelectAll(bool reversed);
- virtual void RevertAll();
+ string16::size_type* end) OVERRIDE;
+ virtual void SelectAll(bool reversed) OVERRIDE;
+ virtual void RevertAll() OVERRIDE;
- virtual void UpdatePopup();
- virtual void ClosePopup();
+ virtual void UpdatePopup() OVERRIDE;
+ virtual void ClosePopup() OVERRIDE;
- virtual void SetFocus();
+ virtual void SetFocus() OVERRIDE;
- virtual void OnTemporaryTextMaybeChanged(const string16& display_text,
- bool save_original_selection);
+ virtual void OnTemporaryTextMaybeChanged(
+ const string16& display_text,
+ bool save_original_selection) OVERRIDE;
virtual bool OnInlineAutocompleteTextMaybeChanged(
- const string16& display_text, size_t user_text_length);
- virtual void OnRevertTemporaryText();
- virtual void OnBeforePossibleChange();
- virtual bool OnAfterPossibleChange();
- virtual gfx::NativeView GetNativeView() const;
- virtual CommandUpdater* GetCommandUpdater();
+ const string16& display_text, size_t user_text_length) OVERRIDE;
+ virtual void OnRevertTemporaryText() OVERRIDE;
+ virtual void OnBeforePossibleChange() OVERRIDE;
+ virtual bool OnAfterPossibleChange() OVERRIDE;
+ virtual gfx::NativeView GetNativeView() const OVERRIDE;
+ virtual CommandUpdater* GetCommandUpdater() OVERRIDE;
virtual void SetInstantSuggestion(const string16& suggestion,
- bool animate_to_complete);
- virtual int TextWidth() const;
- virtual string16 GetInstantSuggestion() const;
- virtual bool IsImeComposing() const;
+ bool animate_to_complete) OVERRIDE;
+ virtual int TextWidth() const OVERRIDE;
+ virtual string16 GetInstantSuggestion() const OVERRIDE;
+ virtual bool IsImeComposing() const OVERRIDE;
- virtual views::View* AddToView(views::View* parent);
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
+ virtual views::View* AddToView(views::View* parent) OVERRIDE;
+ virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE;
int GetPopupMaxYCoordinate();
@@ -209,13 +211,14 @@ class OmniboxViewWin
END_MSG_MAP()
// ui::SimpleMenuModel::Delegate
- virtual bool IsCommandIdChecked(int command_id) const;
- virtual bool IsCommandIdEnabled(int command_id) const;
- virtual bool GetAcceleratorForCommandId(int command_id,
- ui::Accelerator* accelerator);
- virtual bool IsItemForCommandIdDynamic(int command_id) const;
- virtual string16 GetLabelForCommandId(int command_id) const;
- virtual void ExecuteCommand(int command_id);
+ virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
+ virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) OVERRIDE;
+ virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
+ virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
+ virtual void ExecuteCommand(int command_id) OVERRIDE;
// Returns true if the caret is at the end of the content.
bool IsCaretAtEnd() const;
@@ -533,7 +536,7 @@ class OmniboxViewWin
mutable ITextDocument* text_object_model_;
// This contains the scheme char start and stop indexes that should be
- // striken-out when displaying an insecure scheme.
+ // stricken-out when displaying an insecure scheme.
url_parse::Component insecure_scheme_component_;
// Instance of accessibility information and handling.
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 3dc1575..3f3ec9b 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -372,11 +372,11 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
// TODO(jamescook): Proper support for background tabs.
Browser::OpenApplication(
- profile, extension, extension_misc::LAUNCH_TAB, NULL);
+ profile, extension, extension_misc::LAUNCH_TAB, disposition);
} else if (disposition == NEW_WINDOW) {
// Force a new window open.
Browser::OpenApplication(
- profile, extension, extension_misc::LAUNCH_WINDOW, NULL);
+ profile, extension, extension_misc::LAUNCH_WINDOW, disposition);
} else {
// Look at preference to find the right launch container. If no preference
// is set, launch as a regular tab.
@@ -392,13 +392,13 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
old_contents = browser->GetSelectedTabContents();
TabContents* new_contents = Browser::OpenApplication(
- profile, extension, launch_container, old_contents);
+ profile, extension, launch_container,
+ old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB);
// This will also destroy the handler, so do not perform any actions after.
if (new_contents != old_contents && browser->tab_count() > 1)
browser->CloseTabContents(old_contents);
}
-
}
void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) {