diff options
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/app_launcher.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 10 | ||||
-rw-r--r-- | chrome/browser/views/frame/contents_container.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/location_bar/location_bar_view.cc | 97 | ||||
-rw-r--r-- | chrome/browser/views/location_bar/location_bar_view.h | 38 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.h | 2 |
8 files changed, 81 insertions, 82 deletions
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc index 6c5a635..fb2bf50 100644 --- a/chrome/browser/views/app_launcher.cc +++ b/chrome/browser/views/app_launcher.cc @@ -86,7 +86,7 @@ class InfoBubbleContentsView : public views::View, // WARNING: this is not the TabContents of the bubble! Use // GetBubbleTabContents() to get the bubble's TabContents. virtual TabContents* GetTabContents(); - virtual MatchPreview* GetMatchPreview() { return NULL; } + virtual InstantController* GetInstant() { return NULL; } virtual void OnInputInProgress(bool in_progress) {} // CommandUpdater::CommandUpdaterDelegate implementation: diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index a2bacef..8c2eea6 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -26,6 +26,7 @@ #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/dom_ui/bug_report_ui.h" #include "chrome/browser/download/download_manager.h" +#include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/ntp_background_util.h" #include "chrome/browser/page_info_window.h" #include "chrome/browser/prefs/pref_service.h" @@ -33,7 +34,6 @@ #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/sidebar/sidebar_container.h" #include "chrome/browser/sidebar/sidebar_manager.h" -#include "chrome/browser/tab_contents/match_preview.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -1355,14 +1355,14 @@ void BrowserView::ToggleTabStripMode() { frame_->TabStripDisplayModeChanged(); } -void BrowserView::ShowMatchPreview(TabContents* preview_contents) { +void BrowserView::ShowInstant(TabContents* preview_contents) { if (!preview_container_) preview_container_ = new TabContentsContainer(); contents_->SetPreview(preview_container_, preview_contents); preview_container_->ChangeTabContents(preview_contents); } -void BrowserView::HideMatchPreview() { +void BrowserView::HideInstant() { if (!preview_container_) return; @@ -1373,7 +1373,7 @@ void BrowserView::HideMatchPreview() { preview_container_ = NULL; } -gfx::Rect BrowserView::GetMatchPreviewBounds() { +gfx::Rect BrowserView::GetInstantBounds() { return contents_->GetPreviewBounds(); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index ec9111d..71e99e3 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -321,9 +321,9 @@ class BrowserView : public BrowserBubbleHost, virtual void Copy(); virtual void Paste(); virtual void ToggleTabStripMode(); - virtual void ShowMatchPreview(TabContents* preview_contents); - virtual void HideMatchPreview(); - virtual gfx::Rect GetMatchPreviewBounds(); + virtual void ShowInstant(TabContents* preview_contents); + virtual void HideInstant(); + virtual gfx::Rect GetInstantBounds(); // Overridden from BrowserWindowTesting: virtual BookmarkBarView* GetBookmarkBarView() const; @@ -496,7 +496,7 @@ class BrowserView : public BrowserBubbleHost, // Initialize the hung plugin detector. void InitHangMonitor(); - // Invoked from TabSelectedAt or when the match preview is made active. Is + // Invoked from TabSelectedAt or when instant is made active. Is // |change_tab_contents| is true, |new_contents| is added to the view // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents| // has already been added to the view hierarchy. @@ -584,7 +584,7 @@ class BrowserView : public BrowserBubbleHost, // The view that contains devtools window for the selected TabContents. TabContentsContainer* devtools_container_; - // The view that contains the match preview TabContents. + // The view that contains instant's TabContents. TabContentsContainer* preview_container_; // The view managing both the contents_container_ and preview_container_. diff --git a/chrome/browser/views/frame/contents_container.h b/chrome/browser/views/frame/contents_container.h index 9a03c38..fe22d47 100644 --- a/chrome/browser/views/frame/contents_container.h +++ b/chrome/browser/views/frame/contents_container.h @@ -17,7 +17,7 @@ class Widget; // ContentsContainer is responsible for managing the TabContents views. // ContentsContainer has up to two children: one for the currently active -// TabContents and one for the match preview TabContents. +// TabContents and one for instant's TabContents. class ContentsContainer : public views::View { public: ContentsContainer(BrowserView* browser_view, views::View* active); diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc index 5af0fe5..8235e03 100644 --- a/chrome/browser/views/location_bar/location_bar_view.cc +++ b/chrome/browser/views/location_bar/location_bar_view.cc @@ -20,11 +20,11 @@ #include "chrome/browser/defaults.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extensions_service.h" +#include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_model.h" -#include "chrome/browser/tab_contents/match_preview.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/location_bar/content_setting_image_view.h" @@ -101,7 +101,7 @@ LocationBarView::LocationBarView(Profile* profile, show_focus_rect_(false), bubble_type_(FirstRun::MINIMAL_BUBBLE), template_url_model_(NULL), - update_match_preview_(true) { + update_instant_(true) { DCHECK(profile_); SetID(VIEW_ID_LOCATION_BAR); SetFocusable(true); @@ -717,34 +717,34 @@ void LocationBarView::OnMouseReleased(const views::MouseEvent& event, #endif void LocationBarView::OnAutocompleteWillClosePopup() { - if (!update_match_preview_) + if (!update_instant_) return; - MatchPreview* match_preview = delegate_->GetMatchPreview(); - if (match_preview && !match_preview->commit_on_mouse_up()) - match_preview->DestroyPreviewContents(); + InstantController* instant = delegate_->GetInstant(); + if (instant && !instant->commit_on_mouse_up()) + instant->DestroyPreviewContents(); } void LocationBarView::OnAutocompleteLosingFocus( gfx::NativeView view_gaining_focus) { SetSuggestedText(string16()); - MatchPreview* match_preview = delegate_->GetMatchPreview(); - if (!match_preview) + InstantController* instant = delegate_->GetInstant(); + if (!instant) return; - if (!match_preview->is_active() || !match_preview->GetPreviewContents()) + if (!instant->is_active() || !instant->GetPreviewContents()) return; switch (GetCommitType(view_gaining_focus)) { - case COMMIT_MATCH_PREVIEW_IMMEDIATELY: - match_preview->CommitCurrentPreview(MATCH_PREVIEW_COMMIT_FOCUS_LOST); + case COMMIT_INSTANT_IMMEDIATELY: + instant->CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); break; - case COMMIT_MATCH_PREVIEW_ON_MOUSE_UP: - match_preview->SetCommitOnMouseUp(); + case COMMIT_INSTANT_ON_MOUSE_UP: + instant->SetCommitOnMouseUp(); break; - case REVERT_MATCH_PREVIEW: - match_preview->DestroyPreviewContents(); + case REVERT_INSTANT: + instant->DestroyPreviewContents(); break; default: NOTREACHED(); @@ -752,26 +752,26 @@ void LocationBarView::OnAutocompleteLosingFocus( } void LocationBarView::OnAutocompleteWillAccept() { - update_match_preview_ = false; + update_instant_ = false; } bool LocationBarView::OnCommitSuggestedText(const std::wstring& typed_text) { - MatchPreview* match_preview = delegate_->GetMatchPreview(); - if (!match_preview || !suggested_text_view_ || + InstantController* instant = delegate_->GetInstant(); + if (!instant || !suggested_text_view_ || suggested_text_view_->size().IsEmpty() || suggested_text_view_->GetText().empty()) { return false; } - // TODO(sky): I may need to route this through MatchPreview so that we don't + // TODO(sky): I may need to route this through InstantController so that we don't // fetch suggestions for the new combined text. location_entry_->SetUserText(typed_text + suggested_text_view_->GetText()); return true; } void LocationBarView::OnPopupBoundsChanged(const gfx::Rect& bounds) { - MatchPreview* match_preview = delegate_->GetMatchPreview(); - if (match_preview) - match_preview->SetOmniboxBounds(bounds); + InstantController* instant = delegate_->GetInstant(); + if (instant) + instant->SetOmniboxBounds(bounds); } void LocationBarView::OnAutocompleteAccept( @@ -808,10 +808,10 @@ void LocationBarView::OnAutocompleteAccept( } } - if (delegate_->GetMatchPreview()) - delegate_->GetMatchPreview()->DestroyPreviewContents(); + if (delegate_->GetInstant()) + delegate_->GetInstant()->DestroyPreviewContents(); - update_match_preview_ = true; + update_instant_ = true; } void LocationBarView::OnChanged() { @@ -821,17 +821,17 @@ void LocationBarView::OnChanged() { Layout(); SchedulePaint(); - MatchPreview* match_preview = delegate_->GetMatchPreview(); + InstantController* instant = delegate_->GetInstant(); string16 suggested_text; - if (update_match_preview_ && match_preview && GetTabContents()) { + if (update_instant_ && instant && GetTabContents()) { if (location_entry_->model()->user_input_in_progress() && location_entry_->model()->popup_model()->IsOpen()) { - match_preview->Update(GetTabContents(), - location_entry_->model()->CurrentMatch(), - WideToUTF16(location_entry_->GetText()), - &suggested_text); + instant->Update(GetTabContents(), + location_entry_->model()->CurrentMatch(), + WideToUTF16(location_entry_->GetText()), + &suggested_text); } else { - match_preview->DestroyPreviewContents(); + instant->DestroyPreviewContents(); } } @@ -1201,34 +1201,33 @@ void LocationBarView::OnTemplateURLModelChanged() { ShowFirstRunBubble(bubble_type_); } -LocationBarView::MatchPreviewCommitType LocationBarView::GetCommitType( +LocationBarView::InstantCommitType LocationBarView::GetCommitType( gfx::NativeView view_gaining_focus) { - // The MatchPreview is active. Destroy it if the user didn't click on the + // The InstantController is active. Destroy it if the user didn't click on the // TabContents (or one of its children). #if defined(OS_WIN) - MatchPreview* match_preview = delegate_->GetMatchPreview(); + InstantController* instant = delegate_->GetInstant(); RenderWidgetHostView* rwhv = - match_preview->GetPreviewContents()->GetRenderWidgetHostView(); + instant->GetPreviewContents()->GetRenderWidgetHostView(); if (!view_gaining_focus || !rwhv) - return REVERT_MATCH_PREVIEW; + return REVERT_INSTANT; - gfx::NativeView tab_view = - match_preview->GetPreviewContents()->GetNativeView(); + gfx::NativeView tab_view = instant->GetPreviewContents()->GetNativeView(); if (rwhv->GetNativeView() == view_gaining_focus || tab_view == view_gaining_focus) { - // Focus is going to the renderer. Only commit the match preview if the - // mouse is down. If the mouse isn't down it means someone else moved focus - // and we shouldn't commit. - if (match_preview->IsMouseDownFromActivate()) { - if (match_preview->IsShowingInstant()) { + // Focus is going to the renderer. Only commit instant if the mouse is + // down. If the mouse isn't down it means someone else moved focus and we + // shouldn't commit. + if (instant->IsMouseDownFromActivate()) { + if (instant->IsShowingInstant()) { // We're showing instant results. As instant results may shift when // committing we commit on the mouse up. This way a slow click still // works fine. - return COMMIT_MATCH_PREVIEW_ON_MOUSE_UP; + return COMMIT_INSTANT_ON_MOUSE_UP; } - return COMMIT_MATCH_PREVIEW_IMMEDIATELY; + return COMMIT_INSTANT_IMMEDIATELY; } - return REVERT_MATCH_PREVIEW; + return REVERT_INSTANT; } gfx::NativeView view_gaining_focus_ancestor = view_gaining_focus; while (view_gaining_focus_ancestor && @@ -1236,10 +1235,10 @@ LocationBarView::MatchPreviewCommitType LocationBarView::GetCommitType( view_gaining_focus_ancestor = ::GetParent(view_gaining_focus_ancestor); } return view_gaining_focus_ancestor != NULL ? - COMMIT_MATCH_PREVIEW_IMMEDIATELY : REVERT_MATCH_PREVIEW; + COMMIT_INSTANT_IMMEDIATELY : REVERT_INSTANT; #else // TODO: implement me. NOTIMPLEMENTED(); - return REVERT_MATCH_PREVIEW; + return REVERT_INSTANT; #endif } diff --git a/chrome/browser/views/location_bar/location_bar_view.h b/chrome/browser/views/location_bar/location_bar_view.h index 1b8762d..15c785d 100644 --- a/chrome/browser/views/location_bar/location_bar_view.h +++ b/chrome/browser/views/location_bar/location_bar_view.h @@ -36,9 +36,9 @@ class ContentSettingImageView; class EVBubbleView; class ExtensionAction; class GURL; +class InstantController; class KeywordHintView; class LocationIconView; -class MatchPreview; class PageActionWithBadgeView; class Profile; class SelectedKeywordView; @@ -73,8 +73,8 @@ class LocationBarView : public LocationBar, // Should return the current tab contents. virtual TabContents* GetTabContents() = 0; - // Returns the MatchPreview, or NULL if there isn't one. - virtual MatchPreview* GetMatchPreview() = 0; + // Returns the InstantController, or NULL if there isn't one. + virtual InstantController* GetInstant() = 0; // Called by the location bar view when the user starts typing in the edit. // This forces our security style to be UNKNOWN for the duration of the @@ -257,16 +257,16 @@ class LocationBarView : public LocationBar, private: typedef std::vector<ContentSettingImageView*> ContentSettingViews; - // Enumeration of what should happen to the match preview on focus lost. - enum MatchPreviewCommitType { - // The match preview should be committed immediately. - COMMIT_MATCH_PREVIEW_IMMEDIATELY, + // Enumeration of what should happen to instant on focus lost. + enum InstantCommitType { + // The instant preview should be committed immediately. + COMMIT_INSTANT_IMMEDIATELY, - // The match preview should be committed on mouse up. - COMMIT_MATCH_PREVIEW_ON_MOUSE_UP, + // The instant preview should be committed on mouse up. + COMMIT_INSTANT_ON_MOUSE_UP, - // The match preview should be reverted. - REVERT_MATCH_PREVIEW + // The instant preview should be reverted. + REVERT_INSTANT }; friend class PageActionImageView; @@ -311,9 +311,9 @@ class LocationBarView : public LocationBar, // Helper to show the first run info bubble. void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type); - // Returns what should happen to the MatchPreview as a result of focus being - // lost. - MatchPreviewCommitType GetCommitType(gfx::NativeView view_gaining_focus); + // Returns what should happen to the InstantController as a result of focus + // being lost. + InstantCommitType GetCommitType(gfx::NativeView view_gaining_focus); // Current profile. Not owned by us. Profile* profile_; @@ -403,11 +403,11 @@ class LocationBarView : public LocationBar, scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; #endif - // Should the match preview be updated? This is set to false in - // OnAutocompleteWillAccept and true in OnAutocompleteAccept. This is needed - // as prior to accepting an autocomplete suggestion the model is reverted - // which triggers resetting the match preview. - bool update_match_preview_; + // Should instant be updated? This is set to false in OnAutocompleteWillAccept + // and true in OnAutocompleteAccept. This is needed as prior to accepting an + // autocomplete suggestion the model is reverted which triggers resetting + // instant. + bool update_instant_; DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); }; diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index d2cc229..0bd1e1e 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -274,8 +274,8 @@ TabContents* ToolbarView::GetTabContents() { return browser_->GetSelectedTabContents(); } -MatchPreview* ToolbarView::GetMatchPreview() { - return browser_->match_preview(); +InstantController* ToolbarView::GetInstant() { + return browser_->instant(); } void ToolbarView::OnInputInProgress(bool in_progress) { diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index 84ad2b0..1cb8fd0 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -89,7 +89,7 @@ class ToolbarView : public AccessibleToolbarView, // Overridden from LocationBarView::Delegate: virtual TabContents* GetTabContents(); - virtual MatchPreview* GetMatchPreview(); + virtual InstantController* GetInstant(); virtual void OnInputInProgress(bool in_progress); // Overridden from AnimationDelegate: |