| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/dom_ui/new_tab_ui.h" | 7 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 8 | 8 |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 ScopedRunnableMethodFactory<PaintTimer> method_factory_; | 118 ScopedRunnableMethodFactory<PaintTimer> method_factory_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(PaintTimer); | 120 DISALLOW_COPY_AND_ASSIGN(PaintTimer); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 // Adds "url", "title", and "direction" keys on incoming dictionary, setting | 123 // Adds "url", "title", and "direction" keys on incoming dictionary, setting |
| 124 // title as the url as a fallback on empty title. | 124 // title as the url as a fallback on empty title. |
| 125 void SetURLTitleAndDirection(DictionaryValue* dictionary, | 125 void SetURLTitleAndDirection(DictionaryValue* dictionary, |
| 126 const std::wstring& title, | 126 const std::wstring& title, |
| 127 const GURL& gurl) { | 127 const GURL& gurl) { |
| 128 std::wstring wstring_url = UTF8ToWide(gurl.spec()); | 128 string16 string_url = UTF8ToUTF16(gurl.spec()); |
| 129 dictionary->SetString(L"url", wstring_url); | 129 dictionary->SetString(ASCIIToUTF16("url"), string_url); |
| 130 | 130 |
| 131 bool using_url_as_the_title = false; | 131 bool using_url_as_the_title = false; |
| 132 std::wstring title_to_set(title); | 132 std::wstring title_to_set(title); |
| 133 if (title_to_set.empty()) { | 133 if (title_to_set.empty()) { |
| 134 using_url_as_the_title = true; | 134 using_url_as_the_title = true; |
| 135 title_to_set = wstring_url; | 135 title_to_set = UTF16ToWideHack(string_url); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // We set the "dir" attribute of the title, so that in RTL locales, a LTR | 138 // We set the "dir" attribute of the title, so that in RTL locales, a LTR |
| 139 // title is rendered left-to-right and truncated from the right. For example, | 139 // title is rendered left-to-right and truncated from the right. For example, |
| 140 // the title of http://msdn.microsoft.com/en-us/default.aspx is "MSDN: | 140 // the title of http://msdn.microsoft.com/en-us/default.aspx is "MSDN: |
| 141 // Microsoft developer network". In RTL locales, in the [New Tab] page, if | 141 // Microsoft developer network". In RTL locales, in the [New Tab] page, if |
| 142 // the "dir" of this title is not specified, it takes Chrome UI's | 142 // the "dir" of this title is not specified, it takes Chrome UI's |
| 143 // directionality. So the title will be truncated as "soft developer | 143 // directionality. So the title will be truncated as "soft developer |
| 144 // network". Setting the "dir" attribute as "ltr" renders the truncated title | 144 // network". Setting the "dir" attribute as "ltr" renders the truncated title |
| 145 // as "MSDN: Microsoft D...". As another example, the title of | 145 // as "MSDN: Microsoft D...". As another example, the title of |
| (...skipping 15 matching lines...) Expand all Loading... |
| 161 l10n_util::WrapStringWithLTRFormatting(&title_to_set); | 161 l10n_util::WrapStringWithLTRFormatting(&title_to_set); |
| 162 } else { | 162 } else { |
| 163 if (l10n_util::StringContainsStrongRTLChars(title)) { | 163 if (l10n_util::StringContainsStrongRTLChars(title)) { |
| 164 l10n_util::WrapStringWithRTLFormatting(&title_to_set); | 164 l10n_util::WrapStringWithRTLFormatting(&title_to_set); |
| 165 direction = kRTLHtmlTextDirection; | 165 direction = kRTLHtmlTextDirection; |
| 166 } else { | 166 } else { |
| 167 l10n_util::WrapStringWithLTRFormatting(&title_to_set); | 167 l10n_util::WrapStringWithLTRFormatting(&title_to_set); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 dictionary->SetString(L"title", title_to_set); | 171 dictionary->SetString(ASCIIToUTF16("title"), WideToUTF16Hack(title_to_set)); |
| 172 dictionary->SetString(L"direction", direction); | 172 dictionary->SetString(ASCIIToUTF16("direction"), WideToUTF16Hack(direction)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // end anonymous namespace | 175 } // end anonymous namespace |
| 176 | 176 |
| 177 /////////////////////////////////////////////////////////////////////////////// | 177 /////////////////////////////////////////////////////////////////////////////// |
| 178 // NewTabHTMLSource | 178 // NewTabHTMLSource |
| 179 | 179 |
| 180 NewTabHTMLSource::NewTabHTMLSource() | 180 NewTabHTMLSource::NewTabHTMLSource() |
| 181 : DataSource(kNewTabHost, MessageLoop::current()) { | 181 : DataSource(kNewTabHost, MessageLoop::current()) { |
| 182 } | 182 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 201 // Get the current profile name. | 201 // Get the current profile name. |
| 202 std::wstring profile_name = | 202 std::wstring profile_name = |
| 203 UserDataManager::Get()->current_profile_name(); | 203 UserDataManager::Get()->current_profile_name(); |
| 204 title = l10n_util::GetStringF(IDS_NEW_TAB_TITLE_WITH_PROFILE_NAME, | 204 title = l10n_util::GetStringF(IDS_NEW_TAB_TITLE_WITH_PROFILE_NAME, |
| 205 profile_name); | 205 profile_name); |
| 206 most_visited = l10n_util::GetStringF( | 206 most_visited = l10n_util::GetStringF( |
| 207 IDS_NEW_TAB_MOST_VISITED_WITH_PROFILE_NAME, | 207 IDS_NEW_TAB_MOST_VISITED_WITH_PROFILE_NAME, |
| 208 profile_name); | 208 profile_name); |
| 209 } | 209 } |
| 210 DictionaryValue localized_strings; | 210 DictionaryValue localized_strings; |
| 211 localized_strings.SetString(L"title", title); | 211 localized_strings.SetString(ASCIIToUTF16("title"), WideToUTF16Hack(title)); |
| 212 localized_strings.SetString(L"mostvisited", most_visited); | 212 localized_strings.SetString(ASCIIToUTF16("mostvisited"), |
| 213 localized_strings.SetString(L"searches", | 213 WideToUTF16Hack(most_visited)); |
| 214 l10n_util::GetString(IDS_NEW_TAB_SEARCHES)); | 214 localized_strings.SetString(ASCIIToUTF16("searches"), |
| 215 localized_strings.SetString(L"bookmarks", | 215 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_SEARCHES))); |
| 216 l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS)); | 216 localized_strings.SetString(ASCIIToUTF16("bookmarks"), |
| 217 localized_strings.SetString(L"showhistory", | 217 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS))); |
| 218 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW)); | 218 localized_strings.SetString(ASCIIToUTF16("showhistory"), |
| 219 localized_strings.SetString(L"searchhistory", | 219 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW))); |
| 220 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH)); | 220 localized_strings.SetString(ASCIIToUTF16("searchhistory"), |
| 221 localized_strings.SetString(L"recentlyclosed", | 221 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH))); |
| 222 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED)); | 222 localized_strings.SetString(ASCIIToUTF16("recentlyclosed"), |
| 223 localized_strings.SetString(L"mostvisitedintro", | 223 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED))); |
| 224 l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO, | 224 localized_strings.SetString( |
| 225 l10n_util::GetString(IDS_WELCOME_PAGE_URL))); | 225 ASCIIToUTF16("mostvisitedintro"), |
| 226 localized_strings.SetString(L"closedwindow", | 226 WideToUTF16Hack(l10n_util::GetStringF( |
| 227 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); | 227 IDS_NEW_TAB_MOST_VISITED_INTRO, |
| 228 l10n_util::GetString(IDS_WELCOME_PAGE_URL)))); |
| 229 localized_strings.SetString( |
| 230 ASCIIToUTF16("closedwindow"), |
| 231 WideToUTF16Hack( |
| 232 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW))); |
| 228 | 233 |
| 229 localized_strings.SetString(L"textdirection", | 234 localized_strings.SetString( |
| 230 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | 235 ASCIIToUTF16("textdirection"), |
| 231 kRTLHtmlTextDirection : kDefaultHtmlTextDirection); | 236 WideToUTF16Hack( |
| 237 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? |
| 238 kRTLHtmlTextDirection : kDefaultHtmlTextDirection)); |
| 232 | 239 |
| 233 // Let the tab know whether it's the first tab being viewed. | 240 // Let the tab know whether it's the first tab being viewed. |
| 234 localized_strings.SetString(L"firstview", | 241 localized_strings.SetString(ASCIIToUTF16("firstview"), |
| 235 first_view_ ? L"true" : std::wstring()); | 242 first_view_ ? ASCIIToUTF16("true") : string16()); |
| 236 first_view_ = false; | 243 first_view_ = false; |
| 237 | 244 |
| 238 #ifdef CHROME_PERSONALIZATION | 245 #ifdef CHROME_PERSONALIZATION |
| 239 localized_strings.SetString(L"p13nsrc", Personalization::GetNewTabSource()); | 246 localized_strings.SetString(ASCIIToUTF16("p13nsrc"), |
| 247 Personalization::GetNewTabSource()); |
| 240 #endif | 248 #endif |
| 241 | 249 |
| 242 static const StringPiece new_tab_html( | 250 static const StringPiece new_tab_html( |
| 243 ResourceBundle::GetSharedInstance().GetRawDataResource( | 251 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 244 IDR_NEW_TAB_HTML)); | 252 IDR_NEW_TAB_HTML)); |
| 245 | 253 |
| 246 const std::string full_html = jstemplate_builder::GetTemplateHtml( | 254 const std::string full_html = jstemplate_builder::GetTemplateHtml( |
| 247 new_tab_html, &localized_strings, "t" /* template root node id */); | 255 new_tab_html, &localized_strings, "t" /* template root node id */); |
| 248 | 256 |
| 249 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 257 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 250 html_bytes->data.resize(full_html.size()); | 258 html_bytes->data.resize(full_html.size()); |
| 251 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 259 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
| 252 | 260 |
| 253 SendResponse(request_id, html_bytes); | 261 SendResponse(request_id, html_bytes); |
| 254 } | 262 } |
| 255 | 263 |
| 256 /////////////////////////////////////////////////////////////////////////////// | 264 /////////////////////////////////////////////////////////////////////////////// |
| 257 // IncognitoTabHTMLSource | 265 // IncognitoTabHTMLSource |
| 258 | 266 |
| 259 IncognitoTabHTMLSource::IncognitoTabHTMLSource() | 267 IncognitoTabHTMLSource::IncognitoTabHTMLSource() |
| 260 : DataSource("new-tab", MessageLoop::current()) { | 268 : DataSource("new-tab", MessageLoop::current()) { |
| 261 } | 269 } |
| 262 | 270 |
| 263 void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, | 271 void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, |
| 264 int request_id) { | 272 int request_id) { |
| 265 DictionaryValue localized_strings; | 273 DictionaryValue localized_strings; |
| 266 localized_strings.SetString(L"title", | 274 localized_strings.SetString(ASCIIToUTF16("title"), |
| 267 l10n_util::GetString(IDS_NEW_TAB_TITLE)); | 275 WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_TITLE))); |
| 268 localized_strings.SetString(L"content", | 276 localized_strings.SetString( |
| 269 l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, | 277 ASCIIToUTF16("content"), |
| 270 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); | 278 WideToUTF16Hack(l10n_util::GetStringF( |
| 279 IDS_NEW_TAB_OTR_MESSAGE, |
| 280 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL)))); |
| 271 | 281 |
| 272 localized_strings.SetString(L"textdirection", | 282 localized_strings.SetString( |
| 273 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | 283 ASCIIToUTF16("textdirection"), |
| 274 kRTLHtmlTextDirection : kDefaultHtmlTextDirection); | 284 WideToUTF16Hack( |
| 285 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? |
| 286 kRTLHtmlTextDirection : kDefaultHtmlTextDirection)); |
| 275 | 287 |
| 276 static const StringPiece incognito_tab_html( | 288 static const StringPiece incognito_tab_html( |
| 277 ResourceBundle::GetSharedInstance().GetRawDataResource( | 289 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 278 IDR_INCOGNITO_TAB_HTML)); | 290 IDR_INCOGNITO_TAB_HTML)); |
| 279 | 291 |
| 280 const std::string full_html = jstemplate_builder::GetTemplateHtml( | 292 const std::string full_html = jstemplate_builder::GetTemplateHtml( |
| 281 incognito_tab_html, &localized_strings, "t" /* template root node id */); | 293 incognito_tab_html, &localized_strings, "t" /* template root node id */); |
| 282 | 294 |
| 283 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 295 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 284 html_bytes->data.resize(full_html.size()); | 296 html_bytes->data.resize(full_html.size()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 sort(urls.begin(), urls.end(), TemplateURLSortByUsage); | 486 sort(urls.begin(), urls.end(), TemplateURLSortByUsage); |
| 475 ListValue urls_value; | 487 ListValue urls_value; |
| 476 for (size_t i = 0; i < std::min<size_t>(urls.size(), kSearchURLs); ++i) { | 488 for (size_t i = 0; i < std::min<size_t>(urls.size(), kSearchURLs); ++i) { |
| 477 if (urls[i]->usage_count() == 0) | 489 if (urls[i]->usage_count() == 0) |
| 478 break; // urls is sorted by usage count; the remainder would be no good. | 490 break; // urls is sorted by usage count; the remainder would be no good. |
| 479 | 491 |
| 480 const TemplateURLRef* urlref = urls[i]->url(); | 492 const TemplateURLRef* urlref = urls[i]->url(); |
| 481 if (!urlref) | 493 if (!urlref) |
| 482 continue; | 494 continue; |
| 483 DictionaryValue* entry_value = new DictionaryValue; | 495 DictionaryValue* entry_value = new DictionaryValue; |
| 484 entry_value->SetString(L"short_name", urls[i]->short_name()); | 496 entry_value->SetString(ASCIIToUTF16("short_name"), |
| 485 entry_value->SetString(L"keyword", urls[i]->keyword()); | 497 WideToUTF16Hack(urls[i]->short_name())); |
| 498 entry_value->SetString(ASCIIToUTF16("keyword"), |
| 499 WideToUTF16Hack(urls[i]->keyword())); |
| 486 | 500 |
| 487 const GURL& url = urls[i]->GetFavIconURL(); | 501 const GURL& url = urls[i]->GetFavIconURL(); |
| 488 if (url.is_valid()) | 502 if (url.is_valid()) |
| 489 entry_value->SetString(L"favIconURL", UTF8ToWide(url.spec())); | 503 entry_value->SetString(ASCIIToUTF16("favIconURL"), |
| 504 UTF8ToUTF16(url.spec())); |
| 490 | 505 |
| 491 urls_value.Append(entry_value); | 506 urls_value.Append(entry_value); |
| 492 } | 507 } |
| 493 UMA_HISTOGRAM_COUNTS("NewTabPage.SearchURLs.Total", urls_value.GetSize()); | 508 UMA_HISTOGRAM_COUNTS("NewTabPage.SearchURLs.Total", urls_value.GetSize()); |
| 494 dom_ui_->CallJavascriptFunction(L"searchURLs", urls_value); | 509 dom_ui_->CallJavascriptFunction(L"searchURLs", urls_value); |
| 495 } | 510 } |
| 496 | 511 |
| 497 /////////////////////////////////////////////////////////////////////////////// | 512 /////////////////////////////////////////////////////////////////////////////// |
| 498 // RecentlyBookmarkedHandler | 513 // RecentlyBookmarkedHandler |
| 499 | 514 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 // whose selected navigation is not the new tab ui. | 653 // whose selected navigation is not the new tab ui. |
| 639 for (TabRestoreService::Entries::const_iterator it = entries.begin(); | 654 for (TabRestoreService::Entries::const_iterator it = entries.begin(); |
| 640 it != entries.end() && added_count < 3; ++it) { | 655 it != entries.end() && added_count < 3; ++it) { |
| 641 TabRestoreService::Entry* entry = *it; | 656 TabRestoreService::Entry* entry = *it; |
| 642 DictionaryValue* value = new DictionaryValue(); | 657 DictionaryValue* value = new DictionaryValue(); |
| 643 if ((entry->type == TabRestoreService::TAB && | 658 if ((entry->type == TabRestoreService::TAB && |
| 644 TabToValue(*static_cast<TabRestoreService::Tab*>(entry), value)) || | 659 TabToValue(*static_cast<TabRestoreService::Tab*>(entry), value)) || |
| 645 (entry->type == TabRestoreService::WINDOW && | 660 (entry->type == TabRestoreService::WINDOW && |
| 646 WindowToValue(*static_cast<TabRestoreService::Window*>(entry), | 661 WindowToValue(*static_cast<TabRestoreService::Window*>(entry), |
| 647 value))) { | 662 value))) { |
| 648 value->SetInteger(L"sessionId", entry->id); | 663 value->SetInteger(ASCIIToUTF16("sessionId"), entry->id); |
| 649 list_value.Append(value); | 664 list_value.Append(value); |
| 650 added_count++; | 665 added_count++; |
| 651 } else { | 666 } else { |
| 652 delete value; | 667 delete value; |
| 653 } | 668 } |
| 654 } | 669 } |
| 655 dom_ui_->CallJavascriptFunction(L"recentlyClosedTabs", list_value); | 670 dom_ui_->CallJavascriptFunction(L"recentlyClosedTabs", list_value); |
| 656 } | 671 } |
| 657 | 672 |
| 658 void RecentlyClosedTabsHandler::TabRestoreServiceDestroyed( | 673 void RecentlyClosedTabsHandler::TabRestoreServiceDestroyed( |
| 659 TabRestoreService* service) { | 674 TabRestoreService* service) { |
| 660 tab_restore_service_ = NULL; | 675 tab_restore_service_ = NULL; |
| 661 } | 676 } |
| 662 | 677 |
| 663 bool RecentlyClosedTabsHandler::TabToValue( | 678 bool RecentlyClosedTabsHandler::TabToValue( |
| 664 const TabRestoreService::Tab& tab, | 679 const TabRestoreService::Tab& tab, |
| 665 DictionaryValue* dictionary) { | 680 DictionaryValue* dictionary) { |
| 666 if (tab.navigations.empty()) | 681 if (tab.navigations.empty()) |
| 667 return false; | 682 return false; |
| 668 | 683 |
| 669 const TabNavigation& current_navigation = | 684 const TabNavigation& current_navigation = |
| 670 tab.navigations.at(tab.current_navigation_index); | 685 tab.navigations.at(tab.current_navigation_index); |
| 671 if (current_navigation.url() == NewTabUI::GetBaseURL()) | 686 if (current_navigation.url() == NewTabUI::GetBaseURL()) |
| 672 return false; | 687 return false; |
| 673 | 688 |
| 674 SetURLTitleAndDirection(dictionary, current_navigation.title(), | 689 SetURLTitleAndDirection(dictionary, current_navigation.title(), |
| 675 current_navigation.url()); | 690 current_navigation.url()); |
| 676 dictionary->SetString(L"type", L"tab"); | 691 dictionary->SetString(ASCIIToUTF16("type"), ASCIIToUTF16("tab")); |
| 677 return true; | 692 return true; |
| 678 } | 693 } |
| 679 | 694 |
| 680 bool RecentlyClosedTabsHandler::WindowToValue( | 695 bool RecentlyClosedTabsHandler::WindowToValue( |
| 681 const TabRestoreService::Window& window, | 696 const TabRestoreService::Window& window, |
| 682 DictionaryValue* dictionary) { | 697 DictionaryValue* dictionary) { |
| 683 if (window.tabs.empty()) { | 698 if (window.tabs.empty()) { |
| 684 NOTREACHED(); | 699 NOTREACHED(); |
| 685 return false; | 700 return false; |
| 686 } | 701 } |
| 687 | 702 |
| 688 ListValue* tab_values = new ListValue(); | 703 ListValue* tab_values = new ListValue(); |
| 689 for (size_t i = 0; i < window.tabs.size(); ++i) { | 704 for (size_t i = 0; i < window.tabs.size(); ++i) { |
| 690 DictionaryValue* tab_value = new DictionaryValue(); | 705 DictionaryValue* tab_value = new DictionaryValue(); |
| 691 if (TabToValue(window.tabs[i], tab_value)) | 706 if (TabToValue(window.tabs[i], tab_value)) |
| 692 tab_values->Append(tab_value); | 707 tab_values->Append(tab_value); |
| 693 else | 708 else |
| 694 delete tab_value; | 709 delete tab_value; |
| 695 } | 710 } |
| 696 if (tab_values->GetSize() == 0) { | 711 if (tab_values->GetSize() == 0) { |
| 697 delete tab_values; | 712 delete tab_values; |
| 698 return false; | 713 return false; |
| 699 } | 714 } |
| 700 | 715 |
| 701 dictionary->SetString(L"type", L"window"); | 716 dictionary->SetString(ASCIIToUTF16("type"), ASCIIToUTF16("window")); |
| 702 dictionary->Set(L"tabs", tab_values); | 717 dictionary->Set(ASCIIToUTF16("tabs"), tab_values); |
| 703 return true; | 718 return true; |
| 704 } | 719 } |
| 705 | 720 |
| 706 /////////////////////////////////////////////////////////////////////////////// | 721 /////////////////////////////////////////////////////////////////////////////// |
| 707 // HistoryHandler | 722 // HistoryHandler |
| 708 | 723 |
| 709 HistoryHandler::HistoryHandler(DOMUI* dom_ui) | 724 HistoryHandler::HistoryHandler(DOMUI* dom_ui) |
| 710 : DOMMessageHandler(dom_ui), | 725 : DOMMessageHandler(dom_ui), |
| 711 dom_ui_(dom_ui) { | 726 dom_ui_(dom_ui) { |
| 712 dom_ui->RegisterMessageCallback("showHistoryPage", | 727 dom_ui->RegisterMessageCallback("showHistoryPage", |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 const GURL&, | 893 const GURL&, |
| 879 WindowOpenDisposition disposition) { | 894 WindowOpenDisposition disposition) { |
| 880 // The user opened a URL on the page (including "open in new window"). | 895 // The user opened a URL on the page (including "open in new window"). |
| 881 // We count all such clicks as AUTO_BOOKMARK, which increments the site's | 896 // We count all such clicks as AUTO_BOOKMARK, which increments the site's |
| 882 // visit count (which is used for ranking the most visited entries). | 897 // visit count (which is used for ranking the most visited entries). |
| 883 // Note this means we're including clicks on not only most visited | 898 // Note this means we're including clicks on not only most visited |
| 884 // thumbnails, but also clicks on recently bookmarked. | 899 // thumbnails, but also clicks on recently bookmarked. |
| 885 get_contents()->OpenURL(url, GURL(), disposition, | 900 get_contents()->OpenURL(url, GURL(), disposition, |
| 886 PageTransition::AUTO_BOOKMARK); | 901 PageTransition::AUTO_BOOKMARK); |
| 887 } | 902 } |
| OLD | NEW |