Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/api/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/extensions/window_controller_list.h" 21 #include "chrome/browser/extensions/window_controller_list.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/search/search.h" 23 #include "chrome/browser/search/search.h"
24 #include "chrome/browser/sessions/session_restore.h" 24 #include "chrome/browser/sessions/session_restore.h"
25 #include "chrome/browser/sessions/tab_restore_service_factory.h" 25 #include "chrome/browser/sessions/tab_restore_service_factory.h"
26 #include "chrome/browser/sync/profile_sync_service_factory.h" 26 #include "chrome/browser/sync/profile_sync_service_factory.h"
27 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/browser_live_tab_context.h" 29 #include "chrome/browser/ui/browser_live_tab_context.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/common/pref_names.h"
32 #include "components/browser_sync/browser/profile_sync_service.h" 31 #include "components/browser_sync/browser/profile_sync_service.h"
33 #include "components/prefs/pref_service.h"
34 #include "components/sessions/content/content_live_tab.h" 32 #include "components/sessions/content/content_live_tab.h"
35 #include "components/sync_sessions/open_tabs_ui_delegate.h" 33 #include "components/sync_sessions/open_tabs_ui_delegate.h"
36 #include "components/sync_sessions/synced_session.h" 34 #include "components/sync_sessions/synced_session.h"
37 #include "components/url_formatter/url_formatter.h" 35 #include "components/url_formatter/url_formatter.h"
38 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
39 #include "extensions/browser/extension_function_dispatcher.h" 37 #include "extensions/browser/extension_function_dispatcher.h"
40 #include "extensions/browser/extension_function_registry.h" 38 #include "extensions/browser/extension_function_registry.h"
41 #include "extensions/browser/extension_system.h" 39 #include "extensions/browser/extension_system.h"
42 #include "extensions/common/error_utils.h" 40 #include "extensions/common/error_utils.h"
43 #include "ui/base/layout.h" 41 #include "ui/base/layout.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const GURL& url = current_navigation.virtual_url(); 84 const GURL& url = current_navigation.virtual_url();
87 std::string title = base::UTF16ToUTF8(current_navigation.title()); 85 std::string title = base::UTF16ToUTF8(current_navigation.title());
88 86
89 tab_struct.session_id.reset(new std::string(session_id)); 87 tab_struct.session_id.reset(new std::string(session_id));
90 tab_struct.url.reset(new std::string(url.spec())); 88 tab_struct.url.reset(new std::string(url.spec()));
91 tab_struct.fav_icon_url.reset( 89 tab_struct.fav_icon_url.reset(
92 new std::string(current_navigation.favicon_url().spec())); 90 new std::string(current_navigation.favicon_url().spec()));
93 if (!title.empty()) { 91 if (!title.empty()) {
94 tab_struct.title.reset(new std::string(title)); 92 tab_struct.title.reset(new std::string(title));
95 } else { 93 } else {
96 const std::string languages =
97 profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
98 tab_struct.title.reset(new std::string( 94 tab_struct.title.reset(new std::string(
99 base::UTF16ToUTF8(url_formatter::FormatUrl(url, languages)))); 95 base::UTF16ToUTF8(url_formatter::FormatUrl(url))));
100 } 96 }
101 tab_struct.index = index; 97 tab_struct.index = index;
102 tab_struct.pinned = pinned; 98 tab_struct.pinned = pinned;
103 // Note: |selected_index| from the sync sessions model is what we call 99 // Note: |selected_index| from the sync sessions model is what we call
104 // "active" in extensions terminology. "selected" is deprecated because it's 100 // "active" in extensions terminology. "selected" is deprecated because it's
105 // not clear whether it means "active" (user can see) or "highlighted" (user 101 // not clear whether it means "active" (user can see) or "highlighted" (user
106 // has highlighted, since you can select tabs without bringing them into the 102 // has highlighted, since you can select tabs without bringing them into the
107 // foreground). 103 // foreground).
108 tab_struct.active = index == selected_index; 104 tab_struct.active = index == selected_index;
109 ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct); 105 ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return g_factory.Pointer(); 636 return g_factory.Pointer();
641 } 637 }
642 638
643 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { 639 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) {
644 sessions_event_router_.reset( 640 sessions_event_router_.reset(
645 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); 641 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_)));
646 EventRouter::Get(browser_context_)->UnregisterObserver(this); 642 EventRouter::Get(browser_context_)->UnregisterObserver(this);
647 } 643 }
648 644
649 } // namespace extensions 645 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698