| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const std::string& session_id, | 77 const std::string& session_id, |
| 78 int index, | 78 int index, |
| 79 bool pinned, | 79 bool pinned, |
| 80 int selected_index, | 80 int selected_index, |
| 81 const Extension* extension) { | 81 const Extension* extension) { |
| 82 scoped_ptr<tabs::Tab> tab_struct(new tabs::Tab); | 82 scoped_ptr<tabs::Tab> tab_struct(new tabs::Tab); |
| 83 | 83 |
| 84 const GURL& url = current_navigation.virtual_url(); | 84 const GURL& url = current_navigation.virtual_url(); |
| 85 std::string title = base::UTF16ToUTF8(current_navigation.title()); | 85 std::string title = base::UTF16ToUTF8(current_navigation.title()); |
| 86 | 86 |
| 87 tab_struct->id = -1; |
| 87 tab_struct->session_id.reset(new std::string(session_id)); | 88 tab_struct->session_id.reset(new std::string(session_id)); |
| 88 tab_struct->url.reset(new std::string(url.spec())); | 89 tab_struct->url.reset(new std::string(url.spec())); |
| 89 tab_struct->fav_icon_url.reset( | 90 tab_struct->fav_icon_url.reset( |
| 90 new std::string(current_navigation.favicon_url().spec())); | 91 new std::string(current_navigation.favicon_url().spec())); |
| 91 if (!title.empty()) { | 92 if (!title.empty()) { |
| 92 tab_struct->title.reset(new std::string(title)); | 93 tab_struct->title.reset(new std::string(title)); |
| 93 } else { | 94 } else { |
| 94 const std::string languages = | 95 const std::string languages = |
| 95 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 96 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 96 tab_struct->title.reset( | 97 tab_struct->title.reset( |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 return g_factory.Pointer(); | 650 return g_factory.Pointer(); |
| 650 } | 651 } |
| 651 | 652 |
| 652 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 653 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 653 sessions_event_router_.reset( | 654 sessions_event_router_.reset( |
| 654 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 655 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 655 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 656 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 656 } | 657 } |
| 657 | 658 |
| 658 } // namespace extensions | 659 } // namespace extensions |
| OLD | NEW |