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

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

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Get session ID from entries, take tabs' active status directly instead of an index Created 4 years, 4 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 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 #include "components/url_formatter/url_formatter.h" 37 #include "components/url_formatter/url_formatter.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 #include "extensions/browser/extension_function_dispatcher.h" 39 #include "extensions/browser/extension_function_dispatcher.h"
40 #include "extensions/browser/extension_function_registry.h" 40 #include "extensions/browser/extension_function_registry.h"
41 #include "extensions/browser/extension_system.h" 41 #include "extensions/browser/extension_system.h"
42 #include "extensions/common/error_utils.h" 42 #include "extensions/common/error_utils.h"
43 #include "ui/base/layout.h" 43 #include "ui/base/layout.h"
44 44
45 namespace extensions { 45 namespace extensions {
46 46
47 namespace {
48
47 namespace GetRecentlyClosed = api::sessions::GetRecentlyClosed; 49 namespace GetRecentlyClosed = api::sessions::GetRecentlyClosed;
48 namespace GetDevices = api::sessions::GetDevices; 50 namespace GetDevices = api::sessions::GetDevices;
49 namespace Restore = api::sessions::Restore; 51 namespace Restore = api::sessions::Restore;
50 namespace tabs = api::tabs; 52 namespace tabs = api::tabs;
51 namespace windows = api::windows; 53 namespace windows = api::windows;
52 54
53 const char kNoRecentlyClosedSessionsError[] = 55 const char kNoRecentlyClosedSessionsError[] =
54 "There are no recently closed sessions."; 56 "There are no recently closed sessions.";
55 const char kInvalidSessionIdError[] = "Invalid session id: \"*\"."; 57 const char kInvalidSessionIdError[] = "Invalid session id: \"*\".";
56 const char kNoBrowserToRestoreSession[] = 58 const char kNoBrowserToRestoreSession[] =
(...skipping 15 matching lines...) Expand all
72 const sessions::SessionTab* t2) { 74 const sessions::SessionTab* t2) {
73 return t1->timestamp > t2->timestamp; 75 return t1->timestamp > t2->timestamp;
74 } 76 }
75 77
76 tabs::Tab CreateTabModelHelper( 78 tabs::Tab CreateTabModelHelper(
77 Profile* profile, 79 Profile* profile,
78 const sessions::SerializedNavigationEntry& current_navigation, 80 const sessions::SerializedNavigationEntry& current_navigation,
79 const std::string& session_id, 81 const std::string& session_id,
80 int index, 82 int index,
81 bool pinned, 83 bool pinned,
82 int selected_index, 84 bool active,
83 const Extension* extension) { 85 const Extension* extension) {
84 tabs::Tab tab_struct; 86 tabs::Tab tab_struct;
85 87
86 const GURL& url = current_navigation.virtual_url(); 88 const GURL& url = current_navigation.virtual_url();
87 std::string title = base::UTF16ToUTF8(current_navigation.title()); 89 std::string title = base::UTF16ToUTF8(current_navigation.title());
88 90
89 tab_struct.session_id.reset(new std::string(session_id)); 91 tab_struct.session_id.reset(new std::string(session_id));
90 tab_struct.url.reset(new std::string(url.spec())); 92 tab_struct.url.reset(new std::string(url.spec()));
91 tab_struct.fav_icon_url.reset( 93 tab_struct.fav_icon_url.reset(
92 new std::string(current_navigation.favicon_url().spec())); 94 new std::string(current_navigation.favicon_url().spec()));
93 if (!title.empty()) { 95 if (!title.empty()) {
94 tab_struct.title.reset(new std::string(title)); 96 tab_struct.title.reset(new std::string(title));
95 } else { 97 } else {
96 tab_struct.title.reset(new std::string( 98 tab_struct.title.reset(new std::string(
97 base::UTF16ToUTF8(url_formatter::FormatUrl(url)))); 99 base::UTF16ToUTF8(url_formatter::FormatUrl(url))));
98 } 100 }
99 tab_struct.index = index; 101 tab_struct.index = index;
100 tab_struct.pinned = pinned; 102 tab_struct.pinned = pinned;
101 // Note: |selected_index| from the sync sessions model is what we call 103 tab_struct.active = active;
102 // "active" in extensions terminology. "selected" is deprecated because it's
103 // not clear whether it means "active" (user can see) or "highlighted" (user
104 // has highlighted, since you can select tabs without bringing them into the
105 // foreground).
106 tab_struct.active = index == selected_index;
107 ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct); 104 ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct);
108 return tab_struct; 105 return tab_struct;
109 } 106 }
110 107
111 std::unique_ptr<windows::Window> CreateWindowModelHelper( 108 std::unique_ptr<windows::Window> CreateWindowModelHelper(
112 std::unique_ptr<std::vector<tabs::Tab>> tabs, 109 std::unique_ptr<std::vector<tabs::Tab>> tabs,
113 const std::string& session_id, 110 const std::string& session_id,
114 const windows::WindowType& type, 111 const windows::WindowType& type,
115 const windows::WindowState& state) { 112 const windows::WindowState& state) {
116 std::unique_ptr<windows::Window> window_struct(new windows::Window); 113 std::unique_ptr<windows::Window> window_struct(new windows::Window);
(...skipping 16 matching lines...) Expand all
133 session_struct->last_modified = last_modified; 130 session_struct->last_modified = last_modified;
134 if (tab) 131 if (tab)
135 session_struct->tab = std::move(tab); 132 session_struct->tab = std::move(tab);
136 else if (window) 133 else if (window)
137 session_struct->window = std::move(window); 134 session_struct->window = std::move(window);
138 else 135 else
139 NOTREACHED(); 136 NOTREACHED();
140 return session_struct; 137 return session_struct;
141 } 138 }
142 139
143 bool is_tab_entry(const sessions::TabRestoreService::Entry* entry) { 140 bool is_window_entry(const sessions::TabRestoreService::Entry& entry) {
144 return entry->type == sessions::TabRestoreService::TAB; 141 return entry.type == sessions::TabRestoreService::WINDOW;
145 } 142 }
146 143
147 bool is_window_entry(const sessions::TabRestoreService::Entry* entry) { 144 } // namespace
148 return entry->type == sessions::TabRestoreService::WINDOW;
149 }
150 145
151 tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel( 146 tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel(
152 const sessions::TabRestoreService::Tab& tab, 147 const sessions::TabRestoreService::Tab& tab,
153 int session_id, 148 bool active) {
154 int selected_index) {
155 return CreateTabModelHelper(GetProfile(), 149 return CreateTabModelHelper(GetProfile(),
156 tab.navigations[tab.current_navigation_index], 150 tab.navigations[tab.current_navigation_index],
157 base::IntToString(session_id), 151 base::IntToString(tab.id), tab.tabstrip_index,
158 tab.tabstrip_index, 152 tab.pinned, active, extension());
159 tab.pinned,
160 selected_index,
161 extension());
162 } 153 }
163 154
164 std::unique_ptr<windows::Window> 155 std::unique_ptr<windows::Window>
165 SessionsGetRecentlyClosedFunction::CreateWindowModel( 156 SessionsGetRecentlyClosedFunction::CreateWindowModel(
166 const sessions::TabRestoreService::Window& window, 157 const sessions::TabRestoreService::Window& window) {
167 int session_id) {
168 DCHECK(!window.tabs.empty()); 158 DCHECK(!window.tabs.empty());
169 159
170 std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>()); 160 auto tabs = base::MakeUnique<std::vector<tabs::Tab>>();
171 for (size_t i = 0; i < window.tabs.size(); ++i) { 161 for (const auto& tab : window.tabs)
172 tabs->push_back(CreateTabModel(window.tabs[i], window.tabs[i].id, 162 tabs->push_back(
173 window.selected_tab_index)); 163 CreateTabModel(*tab, tab->tabstrip_index == window.selected_tab_index));
174 }
175 164
176 return CreateWindowModelHelper(std::move(tabs), base::IntToString(session_id), 165 return CreateWindowModelHelper(std::move(tabs), base::IntToString(window.id),
177 windows::WINDOW_TYPE_NORMAL, 166 windows::WINDOW_TYPE_NORMAL,
178 windows::WINDOW_STATE_NORMAL); 167 windows::WINDOW_STATE_NORMAL);
179 } 168 }
180 169
181 std::unique_ptr<api::sessions::Session> 170 std::unique_ptr<api::sessions::Session>
182 SessionsGetRecentlyClosedFunction::CreateSessionModel( 171 SessionsGetRecentlyClosedFunction::CreateSessionModel(
183 const sessions::TabRestoreService::Entry* entry) { 172 const sessions::TabRestoreService::Entry& entry) {
184 std::unique_ptr<tabs::Tab> tab; 173 std::unique_ptr<tabs::Tab> tab;
185 std::unique_ptr<windows::Window> window; 174 std::unique_ptr<windows::Window> window;
186 switch (entry->type) { 175 switch (entry.type) {
187 case sessions::TabRestoreService::TAB: 176 case sessions::TabRestoreService::TAB:
188 tab.reset(new tabs::Tab(CreateTabModel( 177 tab.reset(new tabs::Tab(CreateTabModel(
189 *static_cast<const sessions::TabRestoreService::Tab*>(entry), 178 static_cast<const sessions::TabRestoreService::Tab&>(entry), false)));
190 entry->id, -1)));
191 break; 179 break;
192 case sessions::TabRestoreService::WINDOW: 180 case sessions::TabRestoreService::WINDOW:
193 window = CreateWindowModel( 181 window = CreateWindowModel(
194 *static_cast<const sessions::TabRestoreService::Window*>(entry), 182 static_cast<const sessions::TabRestoreService::Window&>(entry));
195 entry->id);
196 break; 183 break;
197 default: 184 default:
198 NOTREACHED(); 185 NOTREACHED();
199 } 186 }
200 return CreateSessionModelHelper(entry->timestamp.ToTimeT(), std::move(tab), 187 return CreateSessionModelHelper(entry.timestamp.ToTimeT(), std::move(tab),
201 std::move(window)); 188 std::move(window));
202 } 189 }
203 190
204 bool SessionsGetRecentlyClosedFunction::RunSync() { 191 bool SessionsGetRecentlyClosedFunction::RunSync() {
205 std::unique_ptr<GetRecentlyClosed::Params> params( 192 std::unique_ptr<GetRecentlyClosed::Params> params(
206 GetRecentlyClosed::Params::Create(*args_)); 193 GetRecentlyClosed::Params::Create(*args_));
207 EXTENSION_FUNCTION_VALIDATE(params); 194 EXTENSION_FUNCTION_VALIDATE(params);
208 int max_results = api::sessions::MAX_SESSION_RESULTS; 195 int max_results = api::sessions::MAX_SESSION_RESULTS;
209 if (params->filter && params->filter->max_results) 196 if (params->filter && params->filter->max_results)
210 max_results = *params->filter->max_results; 197 max_results = *params->filter->max_results;
211 EXTENSION_FUNCTION_VALIDATE(max_results >= 0 && 198 EXTENSION_FUNCTION_VALIDATE(max_results >= 0 &&
212 max_results <= api::sessions::MAX_SESSION_RESULTS); 199 max_results <= api::sessions::MAX_SESSION_RESULTS);
213 200
214 std::vector<api::sessions::Session> result; 201 std::vector<api::sessions::Session> result;
215 sessions::TabRestoreService* tab_restore_service = 202 sessions::TabRestoreService* tab_restore_service =
216 TabRestoreServiceFactory::GetForProfile(GetProfile()); 203 TabRestoreServiceFactory::GetForProfile(GetProfile());
217 204
218 // TabRestoreServiceFactory::GetForProfile() can return NULL (i.e., when in 205 // TabRestoreServiceFactory::GetForProfile() can return NULL (i.e., when in
219 // incognito mode) 206 // incognito mode)
220 if (!tab_restore_service) { 207 if (!tab_restore_service) {
221 DCHECK_NE(GetProfile(), GetProfile()->GetOriginalProfile()) 208 DCHECK_NE(GetProfile(), GetProfile()->GetOriginalProfile())
222 << "sessions::TabRestoreService expected for normal profiles"; 209 << "sessions::TabRestoreService expected for normal profiles";
223 results_ = GetRecentlyClosed::Results::Create(result); 210 results_ = GetRecentlyClosed::Results::Create(result);
224 return true; 211 return true;
225 } 212 }
226 213
227 // List of entries. They are ordered from most to least recent. 214 // List of entries. They are ordered from most to least recent.
228 // We prune the list to contain max 25 entries at any time and removes 215 // We prune the list to contain max 25 entries at any time and removes
229 // uninteresting entries. 216 // uninteresting entries.
230 for (const sessions::TabRestoreService::Entry* entry : 217 for (const auto& entry : tab_restore_service->entries()) {
231 tab_restore_service->entries()) { 218 result.push_back(std::move(*CreateSessionModel(*entry)));
232 result.push_back(std::move(*CreateSessionModel(entry)));
233 } 219 }
234 220
235 results_ = GetRecentlyClosed::Results::Create(result); 221 results_ = GetRecentlyClosed::Results::Create(result);
236 return true; 222 return true;
237 } 223 }
238 224
239 tabs::Tab SessionsGetDevicesFunction::CreateTabModel( 225 tabs::Tab SessionsGetDevicesFunction::CreateTabModel(
240 const std::string& session_tag, 226 const std::string& session_tag,
241 const sessions::SessionTab& tab, 227 const sessions::SessionTab& tab,
242 int tab_index, 228 int tab_index,
243 int selected_index) { 229 bool active) {
244 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString(); 230 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString();
245 return CreateTabModelHelper( 231 return CreateTabModelHelper(
246 GetProfile(), 232 GetProfile(), tab.navigations[tab.normalized_navigation_index()],
247 tab.navigations[tab.normalized_navigation_index()], 233 session_id, tab_index, tab.pinned, active, extension());
248 session_id,
249 tab_index,
250 tab.pinned,
251 selected_index,
252 extension());
253 } 234 }
254 235
255 std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( 236 std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
256 const sessions::SessionWindow& window, 237 const sessions::SessionWindow& window,
257 const std::string& session_tag) { 238 const std::string& session_tag) {
258 DCHECK(!window.tabs.empty()); 239 DCHECK(!window.tabs.empty());
259 240
260 // Prune tabs that are not syncable or are NewTabPage. Then, sort the tabs 241 // Prune tabs that are not syncable or are NewTabPage. Then, sort the tabs
261 // from most recent to least recent. 242 // from most recent to least recent.
262 std::vector<const sessions::SessionTab*> tabs_in_window; 243 std::vector<const sessions::SessionTab*> tabs_in_window;
263 for (size_t i = 0; i < window.tabs.size(); ++i) { 244 for (size_t i = 0; i < window.tabs.size(); ++i) {
264 const sessions::SessionTab* tab = window.tabs[i]; 245 const sessions::SessionTab* tab = window.tabs[i];
265 if (tab->navigations.empty()) 246 if (tab->navigations.empty())
266 continue; 247 continue;
267 const sessions::SerializedNavigationEntry& current_navigation = 248 const sessions::SerializedNavigationEntry& current_navigation =
268 tab->navigations.at(tab->normalized_navigation_index()); 249 tab->navigations.at(tab->normalized_navigation_index());
269 if (search::IsNTPURL(current_navigation.virtual_url(), GetProfile())) { 250 if (search::IsNTPURL(current_navigation.virtual_url(), GetProfile())) {
270 continue; 251 continue;
271 } 252 }
272 tabs_in_window.push_back(tab); 253 tabs_in_window.push_back(tab);
273 } 254 }
274 if (tabs_in_window.empty()) 255 if (tabs_in_window.empty())
275 return std::unique_ptr<windows::Window>(); 256 return std::unique_ptr<windows::Window>();
276 std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency); 257 std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency);
277 258
278 std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>()); 259 std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>());
279 for (size_t i = 0; i < tabs_in_window.size(); ++i) { 260 for (size_t i = 0; i < tabs_in_window.size(); ++i) {
280 tabs->push_back(CreateTabModel(session_tag, *tabs_in_window[i], i, 261 tabs->push_back(CreateTabModel(session_tag, *tabs_in_window[i], i,
281 window.selected_tab_index)); 262 window.selected_tab_index == (int)i));
282 } 263 }
283 264
284 std::string session_id = 265 std::string session_id =
285 SessionId(session_tag, window.window_id.id()).ToString(); 266 SessionId(session_tag, window.window_id.id()).ToString();
286 267
287 windows::WindowType type = windows::WINDOW_TYPE_NONE; 268 windows::WindowType type = windows::WINDOW_TYPE_NONE;
288 switch (window.type) { 269 switch (window.type) {
289 case sessions::SessionWindow::TYPE_TABBED: 270 case sessions::SessionWindow::TYPE_TABBED:
290 type = windows::WINDOW_TYPE_NORMAL; 271 type = windows::WINDOW_TYPE_NORMAL;
291 break; 272 break;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 windows::Window::FromValue(*window_value)); 411 windows::Window::FromValue(*window_value));
431 results_ = Restore::Results::Create(*CreateSessionModelHelper( 412 results_ = Restore::Results::Create(*CreateSessionModelHelper(
432 base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(), 413 base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(),
433 std::move(window))); 414 std::move(window)));
434 return true; 415 return true;
435 } 416 }
436 417
437 bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) { 418 bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) {
438 sessions::TabRestoreService* tab_restore_service = 419 sessions::TabRestoreService* tab_restore_service =
439 TabRestoreServiceFactory::GetForProfile(GetProfile()); 420 TabRestoreServiceFactory::GetForProfile(GetProfile());
440 sessions::TabRestoreService::Entries entries = tab_restore_service->entries(); 421 const sessions::TabRestoreService::Entries& entries =
422 tab_restore_service->entries();
441 423
442 if (entries.empty()) { 424 if (entries.empty()) {
443 SetError(kNoRecentlyClosedSessionsError); 425 SetError(kNoRecentlyClosedSessionsError);
444 return false; 426 return false;
445 } 427 }
446 428
447 bool is_window = is_window_entry(entries.front()); 429 bool is_window = is_window_entry(*entries.front());
448 sessions::LiveTabContext* context = 430 sessions::LiveTabContext* context =
449 BrowserLiveTabContext::FindContextForWebContents( 431 BrowserLiveTabContext::FindContextForWebContents(
450 browser->tab_strip_model()->GetActiveWebContents()); 432 browser->tab_strip_model()->GetActiveWebContents());
451 std::vector<sessions::LiveTab*> restored_tabs = 433 std::vector<sessions::LiveTab*> restored_tabs =
452 tab_restore_service->RestoreMostRecentEntry(context); 434 tab_restore_service->RestoreMostRecentEntry(context);
453 DCHECK(restored_tabs.size()); 435 DCHECK(restored_tabs.size());
454 436
455 sessions::ContentLiveTab* first_tab = 437 sessions::ContentLiveTab* first_tab =
456 static_cast<sessions::ContentLiveTab*>(restored_tabs[0]); 438 static_cast<sessions::ContentLiveTab*>(restored_tabs[0]);
457 if (is_window) { 439 if (is_window) {
458 return SetResultRestoredWindow( 440 return SetResultRestoredWindow(
459 ExtensionTabUtil::GetWindowIdOfTab(first_tab->web_contents())); 441 ExtensionTabUtil::GetWindowIdOfTab(first_tab->web_contents()));
460 } 442 }
461 443
462 SetResultRestoredTab(first_tab->web_contents()); 444 SetResultRestoredTab(first_tab->web_contents());
463 return true; 445 return true;
464 } 446 }
465 447
466 bool SessionsRestoreFunction::RestoreLocalSession(const SessionId& session_id, 448 bool SessionsRestoreFunction::RestoreLocalSession(const SessionId& session_id,
467 Browser* browser) { 449 Browser* browser) {
468 sessions::TabRestoreService* tab_restore_service = 450 sessions::TabRestoreService* tab_restore_service =
469 TabRestoreServiceFactory::GetForProfile(GetProfile()); 451 TabRestoreServiceFactory::GetForProfile(GetProfile());
470 sessions::TabRestoreService::Entries entries = tab_restore_service->entries(); 452 const sessions::TabRestoreService::Entries& entries =
453 tab_restore_service->entries();
471 454
472 if (entries.empty()) { 455 if (entries.empty()) {
473 SetInvalidIdError(session_id.ToString()); 456 SetInvalidIdError(session_id.ToString());
474 return false; 457 return false;
475 } 458 }
476 459
477 // Check if the recently closed list contains an entry with the provided id. 460 // Check if the recently closed list contains an entry with the provided id.
478 bool is_window = false; 461 bool is_window = false;
479 for (sessions::TabRestoreService::Entries::iterator it = entries.begin(); 462 for (const auto& entry : entries) {
480 it != entries.end(); ++it) { 463 if (entry->id == session_id.id()) {
481 if ((*it)->id == session_id.id()) { 464 // A full window is being restored only if the entry ID
482 // The only time a full window is being restored is if the entry ID
483 // matches the provided ID and the entry type is Window. 465 // matches the provided ID and the entry type is Window.
484 is_window = is_window_entry(*it); 466 is_window = is_window_entry(*entry);
485 break; 467 break;
486 } 468 }
487 } 469 }
488 470
489 sessions::LiveTabContext* context = 471 sessions::LiveTabContext* context =
490 BrowserLiveTabContext::FindContextForWebContents( 472 BrowserLiveTabContext::FindContextForWebContents(
491 browser->tab_strip_model()->GetActiveWebContents()); 473 browser->tab_strip_model()->GetActiveWebContents());
492 std::vector<sessions::LiveTab*> restored_tabs = 474 std::vector<sessions::LiveTab*> restored_tabs =
493 tab_restore_service->RestoreEntryById(context, session_id.id(), UNKNOWN); 475 tab_restore_service->RestoreEntryById(context, session_id.id(), UNKNOWN);
494 // If the ID is invalid, restored_tabs will be empty. 476 // If the ID is invalid, restored_tabs will be empty.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 return g_factory.Pointer(); 625 return g_factory.Pointer();
644 } 626 }
645 627
646 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { 628 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) {
647 sessions_event_router_.reset( 629 sessions_event_router_.reset(
648 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); 630 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_)));
649 EventRouter::Get(browser_context_)->UnregisterObserver(this); 631 EventRouter::Get(browser_context_)->UnregisterObserver(this);
650 } 632 }
651 633
652 } // namespace extensions 634 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698