| OLD | NEW |
| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (!title.empty()) { | 90 if (!title.empty()) { |
| 91 tab_struct->title.reset(new std::string(title)); | 91 tab_struct->title.reset(new std::string(title)); |
| 92 } else { | 92 } else { |
| 93 const std::string languages = | 93 const std::string languages = |
| 94 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 94 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 95 tab_struct->title.reset( | 95 tab_struct->title.reset( |
| 96 new std::string(base::UTF16ToUTF8(net::FormatUrl(url, languages)))); | 96 new std::string(base::UTF16ToUTF8(net::FormatUrl(url, languages)))); |
| 97 } | 97 } |
| 98 tab_struct->index = index; | 98 tab_struct->index = index; |
| 99 tab_struct->pinned = pinned; | 99 tab_struct->pinned = pinned; |
| 100 tab_struct->selected = index == selected_index; | 100 // Note: |selected_index| from the sync sessions model is what we call |
| 101 tab_struct->active = false; | 101 // "active" in extensions terminology. "selected" is deprecated because it's |
| 102 // TODO(kalman): Really? Docs say that selected is deprecated and to use | 102 // not clear whether it means "active" (user can see) or "highlighted" (user |
| 103 // highlighted instead, but here we're setting selected but not highlighted. | 103 // has highlighted, since you can select tabs without bringing them into the |
| 104 // Are they supposed to be the same or not? | 104 // foreground). |
| 105 tab_struct->highlighted = false; | 105 tab_struct->active = index == selected_index; |
| 106 tab_struct->incognito = false; | |
| 107 ExtensionTabUtil::ScrubTabForExtension(extension, tab_struct.get()); | 106 ExtensionTabUtil::ScrubTabForExtension(extension, tab_struct.get()); |
| 108 return tab_struct.Pass(); | 107 return tab_struct.Pass(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 scoped_ptr<windows::Window> CreateWindowModelHelper( | 110 scoped_ptr<windows::Window> CreateWindowModelHelper( |
| 112 scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs, | 111 scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs, |
| 113 const std::string& session_id, | 112 const std::string& session_id, |
| 114 const windows::Window::Type& type, | 113 const windows::Window::Type& type, |
| 115 const windows::Window::State& state) { | 114 const windows::Window::State& state) { |
| 116 scoped_ptr<windows::Window> window_struct(new windows::Window); | 115 scoped_ptr<windows::Window> window_struct(new windows::Window); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 return g_factory.Pointer(); | 647 return g_factory.Pointer(); |
| 649 } | 648 } |
| 650 | 649 |
| 651 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 650 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 652 sessions_event_router_.reset( | 651 sessions_event_router_.reset( |
| 653 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 652 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 654 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 653 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 655 } | 654 } |
| 656 | 655 |
| 657 } // namespace extensions | 656 } // namespace extensions |
| OLD | NEW |