summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 19:30:51 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 19:30:51 +0000
commit6b2f7a8c4ca23b35ef56246a7a86b0d414ac89ea (patch)
tree66d4d53b14636317320e4b54233717e1a18dd1eb /chrome
parent434d5c04054dd81df1973b80ffbc8f92b8673d70 (diff)
downloadchromium_src-6b2f7a8c4ca23b35ef56246a7a86b0d414ac89ea.zip
chromium_src-6b2f7a8c4ca23b35ef56246a7a86b0d414ac89ea.tar.gz
chromium_src-6b2f7a8c4ca23b35ef56246a7a86b0d414ac89ea.tar.bz2
Revert my recent changes regarding title directionality.
This reverts: r82400: Plumb direction of document title through IPC layer. r82582: Add and use a base::i18n::StringWithDirection for carrying titles. r82778: Change NavigationEntry's title fields to carry the text direction. I'm going to take an alternative approach; after getting this far, I can see that this approach was too complicated. BUG=27094 Review URL: http://codereview.chromium.org/6901003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc4
-rw-r--r--chrome/browser/debugger/devtools_http_protocol_handler.cc4
-rw-r--r--chrome/browser/external_tab_container_win.cc4
-rw-r--r--chrome/browser/notifications/balloon_host.h6
-rw-r--r--chrome/browser/prerender/prerender_contents.cc14
-rw-r--r--chrome/browser/prerender/prerender_contents.h7
-rw-r--r--chrome/browser/prerender/prerender_manager.cc11
-rw-r--r--chrome/browser/sessions/base_session_service.cc5
-rw-r--r--chrome/browser/sessions/session_service_unittest.cc6
-rw-r--r--chrome/browser/sessions/session_types.cc9
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc5
-rw-r--r--chrome/browser/ui/browser.cc2
-rw-r--r--chrome/browser/ui/cocoa/applescript/tab_applescript.mm7
-rw-r--r--chrome/browser/ui/toolbar/back_forward_menu_model.cc15
-rw-r--r--chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc4
-rw-r--r--chrome/test/ui_test_utils.cc4
16 files changed, 33 insertions, 74 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index f331e4e..2fba820 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -1025,9 +1025,7 @@ void TestingAutomationProvider::GetTabTitle(int handle,
NavigationController* tab = tab_tracker_->GetResource(handle);
NavigationEntry* entry = tab->GetActiveEntry();
if (entry != NULL) {
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- *title = UTF16ToWideHack(entry->GetTitleForDisplay("").string());
+ *title = UTF16ToWideHack(entry->GetTitleForDisplay(""));
} else {
*title = std::wstring();
}
diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc
index 514b506..175de35 100644
--- a/chrome/browser/debugger/devtools_http_protocol_handler.cc
+++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc
@@ -253,9 +253,7 @@ static PageList GeneratePageList(
page_info.id = controller.session_id().id();
page_info.attached = client_host != NULL;
page_info.url = entry->url().spec();
- // TODO(evan): use directionality of title?
- // http://code.google.com/p/chromium/issues/detail?id=27094
- page_info.title = UTF16ToUTF8(entry->title().string());
+ page_info.title = UTF16ToUTF8(entry->title());
page_info.favicon_url = entry->favicon().url().spec();
page_list.push_back(page_info);
}
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index bba5e8e..5c7ec31 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -884,9 +884,7 @@ bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info,
tab_contents_->controller().GetCurrentEntryIndex();
nav_info->url = entry->url();
nav_info->referrer = entry->referrer();
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- nav_info->title = UTF16ToWideHack(entry->title().string());
+ nav_info->title = UTF16ToWideHack(entry->title());
if (nav_info->title.empty())
nav_info->title = UTF8ToWide(nav_info->url.spec());
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 0d483fa..475d6bd 100644
--- a/chrome/browser/notifications/balloon_host.h
+++ b/chrome/browser/notifications/balloon_host.h
@@ -56,10 +56,8 @@ class BalloonHost : public RenderViewHostDelegate,
virtual void RenderViewGone(RenderViewHost* render_view_host,
base::TerminationStatus status,
int error_code);
- virtual void UpdateTitle(
- RenderViewHost* render_view_host,
- int32 page_id,
- const base::i18n::String16WithDirection& title) OVERRIDE {}
+ virtual void UpdateTitle(RenderViewHost* render_view_host,
+ int32 page_id, const std::wstring& title) {}
virtual int GetBrowserWindowID() const;
virtual ViewType::Type GetRenderViewType() const;
virtual RenderViewHostDelegate::View* GetViewDelegate();
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 1d4849f..1310ec3 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/prerender/prerender_contents.h"
-#include "base/i18n/rtl.h"
#include "base/process_util.h"
#include "base/task.h"
#include "base/utf_string_conversions.h"
@@ -277,17 +276,14 @@ void PrerenderContents::DidNavigate(
url_ = params.url;
}
-void PrerenderContents::UpdateTitle(
- RenderViewHost* render_view_host,
- int32 page_id,
- const base::i18n::String16WithDirection& title) {
+void PrerenderContents::UpdateTitle(RenderViewHost* render_view_host,
+ int32 page_id,
+ const std::wstring& title) {
DCHECK_EQ(render_view_host_, render_view_host);
- if (title.string().empty())
+ if (title.empty())
return;
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- title_ = title.string();
+ title_ = WideToUTF16Hack(title);
page_id_ = page_id;
}
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index fc139c0..5dea817 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -120,10 +120,9 @@ class PrerenderContents : public RenderViewHostDelegate,
int error_code) OVERRIDE;
virtual void DidNavigate(RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params);
- virtual void UpdateTitle(
- RenderViewHost* render_view_host,
- int32 page_id,
- const base::i18n::String16WithDirection& title) OVERRIDE;
+ virtual void UpdateTitle(RenderViewHost* render_view_host,
+ int32 page_id,
+ const std::wstring& title);
virtual WebPreferences GetWebkitPrefs();
virtual void RunJavaScriptMessage(const std::wstring& message,
const std::wstring& default_prompt,
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index de6fd21..a6d4b05 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -376,14 +376,9 @@ bool PrerenderManager::MaybeUsePreloadedPage(TabContents* tc, const GURL& url) {
if (p != NULL)
tc->DidNavigate(rvh, *p);
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- string16 title_str = pc->title();
- if (!title_str.empty()) {
- base::i18n::String16WithDirection title(title_str,
- base::i18n::LEFT_TO_RIGHT);
- tc->UpdateTitle(rvh, pc->page_id(), title);
- }
+ string16 title = pc->title();
+ if (!title.empty())
+ tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title));
GURL icon_url = pc->icon_url();
if (!icon_url.is_empty()) {
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index 455f376..ba44fd8 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -158,10 +158,7 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand(
WriteStringToPickle(pickle, &bytes_written, max_state_size,
entry.virtual_url().spec());
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- WriteString16ToPickle(pickle, &bytes_written, max_state_size,
- entry.title().string());
+ WriteString16ToPickle(pickle, &bytes_written, max_state_size, entry.title());
if (entry.has_post_data()) {
// Remove the form data, it may contain sensitive information.
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index b04c015..d10548e9 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -71,11 +71,7 @@ class SessionServiceTest : public BrowserWithTestWindowTest,
NavigationEntry entry;
entry.set_url(navigation.virtual_url());
entry.set_referrer(navigation.referrer());
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- entry.set_title(
- base::i18n::String16WithDirection(navigation.title(),
- base::i18n::LEFT_TO_RIGHT));
+ entry.set_title(navigation.title());
entry.set_content_state(navigation.state());
entry.set_transition_type(navigation.transition());
entry.set_has_post_data(
diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc
index c4dba83..5749f31 100644
--- a/chrome/browser/sessions/session_types.cc
+++ b/chrome/browser/sessions/session_types.cc
@@ -68,10 +68,7 @@ NavigationEntry* TabNavigation::ToNavigationEntry(int page_id,
profile);
entry->set_page_id(page_id);
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- entry->set_title(
- base::i18n::String16WithDirection(title_, base::i18n::LEFT_TO_RIGHT));
+ entry->set_title(title_);
entry->set_content_state(state_);
entry->set_has_post_data(type_mask_ & TabNavigation::HAS_POST_DATA);
@@ -81,9 +78,7 @@ NavigationEntry* TabNavigation::ToNavigationEntry(int page_id,
void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) {
virtual_url_ = entry.virtual_url();
referrer_ = entry.referrer();
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- title_ = entry.title().string();
+ title_ = entry.title();
state_ = entry.content_state();
transition_ = entry.transition_type();
type_mask_ = entry.has_post_data() ? TabNavigation::HAS_POST_DATA : 0;
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 7b21143..6057195 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -237,10 +237,7 @@ TEST_F(TabContentsTest, UpdateTitle) {
NavigationController::LoadCommittedDetails details;
controller().RendererDidNavigate(params, 0, &details);
- base::i18n::String16WithDirection new_title(
- ASCIIToUTF16(" Lots O' Whitespace\n"),
- base::i18n::LEFT_TO_RIGHT);
- contents()->UpdateTitle(rvh(), 0, new_title);
+ contents()->UpdateTitle(rvh(), 0, L" Lots O' Whitespace\n");
EXPECT_EQ(ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle());
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 4d9f3d6..6767931 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -4426,7 +4426,7 @@ void Browser::ViewSource(TabContentsWrapper* contents,
webkit_glue::RemoveScrollOffsetFromHistoryState(content_state));
// Do not restore title, derive it from the url.
- active_entry->set_title(base::i18n::String16WithDirection());
+ active_entry->set_title(string16());
// Now show view-source entry.
if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
index 38295ed..401eb6b 100644
--- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
@@ -125,10 +125,9 @@
return nil;
std::wstring title;
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- if (entry != NULL)
- title = UTF16ToWideHack(entry->title().string());
+ if (entry != NULL) {
+ title = UTF16ToWideHack(entry->title());
+ }
return base::SysWideToNSString(title);
}
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
index b73deef..9577003 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -84,22 +84,19 @@ string16 BackForwardMenuModel::GetLabelAt(int index) const {
// Return the entry title, escaping any '&' characters and eliding it if it's
// super long.
NavigationEntry* entry = GetNavigationEntry(index);
- base::i18n::String16WithDirection menu_text(entry->GetTitleForDisplay(
+ string16 menu_text(entry->GetTitleForDisplay(
GetTabContents()->profile()->GetPrefs()->
GetString(prefs::kAcceptLanguages)));
- string16 elided =
- ui::ElideText(menu_text.string(), gfx::Font(), kMaxWidth, false);
+ menu_text = ui::ElideText(menu_text, gfx::Font(), kMaxWidth, false);
#if !defined(OS_MACOSX)
- for (size_t i = elided.find('&'); i != string16::npos;
- i = elided.find('&', i + 2)) {
- elided.insert(i, 1, '&');
+ for (size_t i = menu_text.find('&'); i != string16::npos;
+ i = menu_text.find('&', i + 2)) {
+ menu_text.insert(i, 1, '&');
}
#endif
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- return elided;
+ return menu_text;
}
bool BackForwardMenuModel::IsItemDynamicAt(int index) const {
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
index 3eef4a6..f7dbd76 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
@@ -73,9 +73,7 @@ class BackFwdMenuModelTest : public RenderViewHostTestHarness {
void LoadURLAndUpdateState(const char* url, const char* title) {
NavigateAndCommit(GURL(url));
- controller().GetLastCommittedEntry()->set_title(
- base::i18n::String16WithDirection(UTF8ToUTF16(title),
- base::i18n::LEFT_TO_RIGHT));
+ controller().GetLastCommittedEntry()->set_title(UTF8ToUTF16(title));
}
// Navigate back or forward the given amount and commits the entry (which
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 7c44a19..6ab4429 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -399,9 +399,7 @@ bool GetCurrentTabTitle(const Browser* browser, string16* title) {
NavigationEntry* last_entry = tab_contents->controller().GetActiveEntry();
if (!last_entry)
return false;
- // TODO(evan): use directionality of title.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- title->assign(last_entry->GetTitleForDisplay("").string());
+ title->assign(last_entry->GetTitleForDisplay(""));
return true;
}