diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 21:04:11 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 21:04:11 +0000 |
commit | ba2bd157297d9e5fac3f781ab9951736e9e29eb8 (patch) | |
tree | 6ffc8322c5fb83d7dcd620bb14f860bb1568797a | |
parent | 1fff4a0530c3ef7d2ea5a8af727100ec04a0e3e9 (diff) | |
download | chromium_src-ba2bd157297d9e5fac3f781ab9951736e9e29eb8.zip chromium_src-ba2bd157297d9e5fac3f781ab9951736e9e29eb8.tar.gz chromium_src-ba2bd157297d9e5fac3f781ab9951736e9e29eb8.tar.bz2 |
Convert FindInPage wstrings to string16.
Review URL: http://codereview.chromium.org/42408
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12158 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/find_bar.h | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.h | 6 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 6 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 2 | ||||
-rw-r--r-- | webkit/glue/find_in_page_request.h | 4 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 8 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 |
14 files changed, 27 insertions, 28 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index ff5f52e..b45ab43 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2456,7 +2456,7 @@ void Browser::FindInPage(bool find_next, bool forward_direction) { window_->ShowFindBar(); if (find_next) { GetSelectedTabContents()->AsWebContents()->StartFinding( - std::wstring(), + string16(), forward_direction); } } diff --git a/chrome/browser/find_bar.h b/chrome/browser/find_bar.h index 5ebb188..4b4ee715 100644 --- a/chrome/browser/find_bar.h +++ b/chrome/browser/find_bar.h @@ -10,6 +10,7 @@ #define CHROME_BROWSER_FIND_BAR_H_ #include "base/gfx/rect.h" +#include "base/string16.h" class FindNotificationDetails; class WebContents; @@ -35,12 +36,12 @@ class FindBar { virtual void StopAnimation() = 0; // Set the text in the find box. - virtual void SetFindText(const std::wstring& find_text) = 0; + virtual void SetFindText(const string16& find_text) = 0; // Updates the FindBar with the find result details contained within the // specified |result|. virtual void UpdateUIForFindResult(const FindNotificationDetails& result, - const std::wstring& find_text) = 0; + const string16& find_text) = 0; // Returns the rectangle representing where to position the find bar. It uses // GetDialogBounds and positions itself within that, either to the left (if an diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index f4dc247..a779a2b8 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -66,11 +66,11 @@ void FindBarGtk::StopAnimation() { // No animation yet, so do nothing. } -void FindBarGtk::SetFindText(const std::wstring& find_text) { +void FindBarGtk::SetFindText(const string16& find_text) { } void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result, - const std::wstring& find_text) { + const string16& find_text) { } gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { @@ -95,7 +95,7 @@ void FindBarGtk::ContentsChanged() { std::string new_contents(gtk_entry_get_text(GTK_ENTRY(find_text_))); if (new_contents.length() > 0) { - web_contents->StartFinding(UTF8ToWide(new_contents), true); + web_contents->StartFinding(UTF8ToUTF16(new_contents), true); } else { // The textbox is empty so we reset. web_contents->StopFinding(true); // true = clear selection on page. diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index a9f0ca7..73b87ee 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -7,8 +7,6 @@ #include <gtk/gtk.h> -#include <string> - #include "base/basictypes.h" #include "chrome/browser/find_bar.h" #include "chrome/common/owned_widget_gtk.h" @@ -42,9 +40,9 @@ class FindBarGtk : public FindBar { virtual void SetFocusAndSelection(); virtual void ClearResults(const FindNotificationDetails& results); virtual void StopAnimation(); - virtual void SetFindText(const std::wstring& find_text); + virtual void SetFindText(const string16& find_text); virtual void UpdateUIForFindResult(const FindNotificationDetails& result, - const std::wstring& find_text); + const string16& find_text); virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect); virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw); virtual bool IsFindBarVisible(); diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 8ce2568..39f0648 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -342,7 +342,7 @@ bool RenderViewHost::PrintPages() { } void RenderViewHost::StartFinding(int request_id, - const std::wstring& search_string, + const string16& search_string, bool forward, bool match_case, bool find_next) { diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 273d1e3..92599ba 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -186,7 +186,7 @@ class RenderViewHost : public RenderWidgetHost { // Start looking for a string within the content of the page, with the // specified options. void StartFinding(int request_id, - const std::wstring& search_string, + const string16& search_string, bool forward, bool match_case, bool find_next); diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index a6fc32c..d0edfa9 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -584,7 +584,7 @@ void WebContents::CreateShortcut() { render_view_host()->GetApplicationInfo(pending_install_.page_id); } -void WebContents::StartFinding(const std::wstring& find_text, +void WebContents::StartFinding(const string16& find_text, bool forward_direction) { // If find_text is empty, it means FindNext was pressed with a keyboard // shortcut so unless we have something to search for we return early. diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index c6c4a26..6e86268 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -195,7 +195,7 @@ class WebContents : public TabContents, // function does not block while a search is in progress. The controller will // receive the results through the notification mechanism. See Observe(...) // for details. - void StartFinding(const std::wstring& find_text, bool forward_direction); + void StartFinding(const string16& find_text, bool forward_direction); // Stops the current Find operation. If |clear_selection| is true, it will // also clear the selection on the focused frame. @@ -216,7 +216,7 @@ class WebContents : public TabContents, // Accessor for find_text_. Used to determine if this WebContents has any // active searches. - std::wstring find_text() const { return find_text_; } + string16 find_text() const { return find_text_; } // Accessor for find_result_. const FindNotificationDetails& find_result() const { return find_result_; } @@ -685,7 +685,7 @@ class WebContents : public TabContents, // The last string we searched for. This is used to figure out if this is a // Find or a FindNext operation (FindNext should not increase the request id). - std::wstring find_text_; + string16 find_text_; // The last find result. This object contains details about the number of // matches, the find selection rectangle, etc. The UI can access this diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc index d653df4..3a9fe05 100644 --- a/chrome/browser/views/find_bar_win.cc +++ b/chrome/browser/views/find_bar_win.cc @@ -207,7 +207,7 @@ void FindBarWin::StopAnimation() { animation_->End(); } -void FindBarWin::SetFindText(const std::wstring& find_text) { +void FindBarWin::SetFindText(const string16& find_text) { view_->SetFindText(find_text); } @@ -477,7 +477,7 @@ void FindBarWin::UnregisterEscAccelerator() { } void FindBarWin::UpdateUIForFindResult(const FindNotificationDetails& result, - const std::wstring& find_text) { + const string16& find_text) { view_->UpdateForResult(result, find_text); // We now need to check if the window is obscuring the search results. diff --git a/chrome/browser/views/find_bar_win.h b/chrome/browser/views/find_bar_win.h index ed53212..99eb1cb 100644 --- a/chrome/browser/views/find_bar_win.h +++ b/chrome/browser/views/find_bar_win.h @@ -82,9 +82,9 @@ class FindBarWin : public views::FocusChangeListener, virtual void SetFocusAndSelection(); virtual void ClearResults(const FindNotificationDetails& results); virtual void StopAnimation(); - virtual void SetFindText(const std::wstring& find_text); + virtual void SetFindText(const string16& find_text); virtual void UpdateUIForFindResult(const FindNotificationDetails& result, - const std::wstring& find_text); + const string16& find_text); virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect); virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw); virtual bool IsFindBarVisible(); diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 1ac8b75..550dc5d 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -52,7 +52,7 @@ int TabProxy::FindInPage(const std::wstring& search_string, return -1; FindInPageRequest request = {0}; - request.search_string = search_string; + request.search_string = WideToUTF16(search_string); request.find_next = find_next; // The explicit comparison to TRUE avoids a warning (C4800). request.match_case = match_case == TRUE; diff --git a/webkit/glue/find_in_page_request.h b/webkit/glue/find_in_page_request.h index a10ca80..8594f05 100644 --- a/webkit/glue/find_in_page_request.h +++ b/webkit/glue/find_in_page_request.h @@ -5,7 +5,7 @@ #ifndef WEBKIT_GLUE_FIND_IN_PAGE_REQUEST_H__ #define WEBKIT_GLUE_FIND_IN_PAGE_REQUEST_H__ -#include <string> +#include "base/string16.h" // Parameters for a find in page request. struct FindInPageRequest { @@ -15,7 +15,7 @@ struct FindInPageRequest { int request_id; // The word(s) to find on the page. - std::wstring search_string; + string16 search_string; // Whether to search forward or backward within the page. bool forward; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index c6f8c4c..49a6a08 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -926,7 +926,7 @@ bool WebFrameImpl::Find(const FindInPageRequest& request, bool wrap_within_frame, gfx::Rect* selection_rect) { WebCore::String webcore_string = - webkit_glue::StdWStringToString(request.search_string); + webkit_glue::String16ToString(request.search_string); WebFrameImpl* const main_frame_impl = static_cast<WebFrameImpl*>(GetView()->GetMainFrame()); @@ -1045,9 +1045,9 @@ bool WebFrameImpl::ShouldScopeMatches(FindInPageRequest request) { // time it was searched, then we don't have to search it again if the user is // just adding to the search string or sending the same search string again. if (scoping_complete_ && - last_search_string_ != std::wstring(L"") && last_match_count_ == 0) { + !last_search_string_.empty() && last_match_count_ == 0) { // Check to see if the search string prefixes match. - std::wstring previous_search_prefix = + string16 previous_search_prefix = request.search_string.substr(0, last_search_string_.length()); if (previous_search_prefix == last_search_string_) { @@ -1142,7 +1142,7 @@ void WebFrameImpl::ScopeStringMatches(FindInPageRequest request, } WebCore::String webcore_string = - webkit_glue::StdWStringToString(request.search_string); + webkit_glue::String16ToString(request.search_string); RefPtr<Range> search_range(rangeOfContents(frame()->document())); diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 8684cb7..004c5ad 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -335,7 +335,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { // short-circuiting searches in the following scenarios: When a frame has // been searched and returned 0 results, we don't need to search that frame // again if the user is just adding to the search (making it more specific). - std::wstring last_search_string_; + string16 last_search_string_; // Keeps track of how many matches this frame has found so far, so that we // don't loose count between scoping efforts, and is also used (in conjunction |