Commit 722186b0 authored by Oscar Johansson's avatar Oscar Johansson Committed by Commit Bot

Remove "using" to avoid namespace conflict

When building using Jumbo namespace aliases with the same
name may end up in the same unit, causing a conflict at
compilation. This commit removes "using windows" and
"using tabs" and instead call the namespace by its full
name. This is done to increase the robustness of the code.

std::unique_ptr<T>() are removed because of presubmit check
errors.

Bug: 850484
Change-Id: I91f44728d4b54dd15213bac602176ca8736bb3cd
Reviewed-on: https://chromium-review.googlesource.com/1107633Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Oscar Johansson <oscarj@opera.com>
Cr-Commit-Position: refs/heads/master@{#569267}
parent 7560bdf2
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
namespace extensions { namespace extensions {
namespace tabs = api::tabs;
namespace windows = api::windows; namespace windows = api::windows;
namespace { namespace {
...@@ -76,14 +75,14 @@ bool SortTabsByRecency(const sessions::SessionTab* t1, ...@@ -76,14 +75,14 @@ bool SortTabsByRecency(const sessions::SessionTab* t1,
return t1->timestamp > t2->timestamp; return t1->timestamp > t2->timestamp;
} }
tabs::Tab CreateTabModelHelper( api::tabs::Tab CreateTabModelHelper(
const sessions::SerializedNavigationEntry& current_navigation, const sessions::SerializedNavigationEntry& current_navigation,
const std::string& session_id, const std::string& session_id,
int index, int index,
bool pinned, bool pinned,
bool active, bool active,
const Extension* extension) { const Extension* extension) {
tabs::Tab tab_struct; api::tabs::Tab tab_struct;
const GURL& url = current_navigation.virtual_url(); const GURL& url = current_navigation.virtual_url();
std::string title = base::UTF16ToUTF8(current_navigation.title()); std::string title = base::UTF16ToUTF8(current_navigation.title());
...@@ -105,12 +104,12 @@ tabs::Tab CreateTabModelHelper( ...@@ -105,12 +104,12 @@ tabs::Tab CreateTabModelHelper(
return tab_struct; return tab_struct;
} }
std::unique_ptr<windows::Window> CreateWindowModelHelper( std::unique_ptr<api::windows::Window> CreateWindowModelHelper(
std::unique_ptr<std::vector<tabs::Tab>> tabs, std::unique_ptr<std::vector<api::tabs::Tab>> tabs,
const std::string& session_id, const std::string& session_id,
const windows::WindowType& type, const api::windows::WindowType& type,
const windows::WindowState& state) { const api::windows::WindowState& state) {
std::unique_ptr<windows::Window> window_struct(new windows::Window); std::unique_ptr<api::windows::Window> window_struct(new api::windows::Window);
window_struct->tabs = std::move(tabs); window_struct->tabs = std::move(tabs);
window_struct->session_id.reset(new std::string(session_id)); window_struct->session_id.reset(new std::string(session_id));
window_struct->incognito = false; window_struct->incognito = false;
...@@ -123,8 +122,8 @@ std::unique_ptr<windows::Window> CreateWindowModelHelper( ...@@ -123,8 +122,8 @@ std::unique_ptr<windows::Window> CreateWindowModelHelper(
std::unique_ptr<api::sessions::Session> CreateSessionModelHelper( std::unique_ptr<api::sessions::Session> CreateSessionModelHelper(
int last_modified, int last_modified,
std::unique_ptr<tabs::Tab> tab, std::unique_ptr<api::tabs::Tab> tab,
std::unique_ptr<windows::Window> window) { std::unique_ptr<api::windows::Window> window) {
std::unique_ptr<api::sessions::Session> session_struct( std::unique_ptr<api::sessions::Session> session_struct(
new api::sessions::Session()); new api::sessions::Session());
session_struct->last_modified = last_modified; session_struct->last_modified = last_modified;
...@@ -143,7 +142,7 @@ bool is_window_entry(const sessions::TabRestoreService::Entry& entry) { ...@@ -143,7 +142,7 @@ bool is_window_entry(const sessions::TabRestoreService::Entry& entry) {
} // namespace } // namespace
tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel( api::tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel(
const sessions::TabRestoreService::Tab& tab, const sessions::TabRestoreService::Tab& tab,
bool active) { bool active) {
return CreateTabModelHelper(tab.navigations[tab.current_navigation_index], return CreateTabModelHelper(tab.navigations[tab.current_navigation_index],
...@@ -152,29 +151,29 @@ tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel( ...@@ -152,29 +151,29 @@ tabs::Tab SessionsGetRecentlyClosedFunction::CreateTabModel(
extension()); extension());
} }
std::unique_ptr<windows::Window> std::unique_ptr<api::windows::Window>
SessionsGetRecentlyClosedFunction::CreateWindowModel( SessionsGetRecentlyClosedFunction::CreateWindowModel(
const sessions::TabRestoreService::Window& window) { const sessions::TabRestoreService::Window& window) {
DCHECK(!window.tabs.empty()); DCHECK(!window.tabs.empty());
auto tabs = std::make_unique<std::vector<tabs::Tab>>(); auto tabs = std::make_unique<std::vector<api::tabs::Tab>>();
for (const auto& tab : window.tabs) for (const auto& tab : window.tabs)
tabs->push_back( tabs->push_back(
CreateTabModel(*tab, tab->tabstrip_index == window.selected_tab_index)); CreateTabModel(*tab, tab->tabstrip_index == window.selected_tab_index));
return CreateWindowModelHelper( return CreateWindowModelHelper(
std::move(tabs), base::IntToString(window.id.id()), std::move(tabs), base::IntToString(window.id.id()),
windows::WINDOW_TYPE_NORMAL, windows::WINDOW_STATE_NORMAL); api::windows::WINDOW_TYPE_NORMAL, api::windows::WINDOW_STATE_NORMAL);
} }
std::unique_ptr<api::sessions::Session> std::unique_ptr<api::sessions::Session>
SessionsGetRecentlyClosedFunction::CreateSessionModel( SessionsGetRecentlyClosedFunction::CreateSessionModel(
const sessions::TabRestoreService::Entry& entry) { const sessions::TabRestoreService::Entry& entry) {
std::unique_ptr<tabs::Tab> tab; std::unique_ptr<api::tabs::Tab> tab;
std::unique_ptr<windows::Window> window; std::unique_ptr<api::windows::Window> window;
switch (entry.type) { switch (entry.type) {
case sessions::TabRestoreService::TAB: case sessions::TabRestoreService::TAB:
tab.reset(new tabs::Tab(CreateTabModel( tab.reset(new api::tabs::Tab(CreateTabModel(
static_cast<const sessions::TabRestoreService::Tab&>(entry), false))); static_cast<const sessions::TabRestoreService::Tab&>(entry), false)));
break; break;
case sessions::TabRestoreService::WINDOW: case sessions::TabRestoreService::WINDOW:
...@@ -221,7 +220,7 @@ ExtensionFunction::ResponseAction SessionsGetRecentlyClosedFunction::Run() { ...@@ -221,7 +220,7 @@ ExtensionFunction::ResponseAction SessionsGetRecentlyClosedFunction::Run() {
return RespondNow(ArgumentList(GetRecentlyClosed::Results::Create(result))); return RespondNow(ArgumentList(GetRecentlyClosed::Results::Create(result)));
} }
tabs::Tab SessionsGetDevicesFunction::CreateTabModel( api::tabs::Tab SessionsGetDevicesFunction::CreateTabModel(
const std::string& session_tag, const std::string& session_tag,
const sessions::SessionTab& tab, const sessions::SessionTab& tab,
int tab_index, int tab_index,
...@@ -232,7 +231,8 @@ tabs::Tab SessionsGetDevicesFunction::CreateTabModel( ...@@ -232,7 +231,8 @@ tabs::Tab SessionsGetDevicesFunction::CreateTabModel(
tab.pinned, active, extension()); tab.pinned, active, extension());
} }
std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( std::unique_ptr<api::windows::Window>
SessionsGetDevicesFunction::CreateWindowModel(
const sessions::SessionWindow& window, const sessions::SessionWindow& window,
const std::string& session_tag) { const std::string& session_tag) {
DCHECK(!window.tabs.empty()); DCHECK(!window.tabs.empty());
...@@ -253,10 +253,11 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( ...@@ -253,10 +253,11 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
tabs_in_window.push_back(tab); tabs_in_window.push_back(tab);
} }
if (tabs_in_window.empty()) if (tabs_in_window.empty())
return std::unique_ptr<windows::Window>(); return nullptr;
std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency); std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency);
std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>()); std::unique_ptr<std::vector<api::tabs::Tab>> tabs(
new std::vector<api::tabs::Tab>());
for (size_t i = 0; i < tabs_in_window.size(); ++i) { for (size_t i = 0; i < tabs_in_window.size(); ++i) {
tabs->push_back(CreateTabModel(session_tag, *tabs_in_window[i], i, tabs->push_back(CreateTabModel(session_tag, *tabs_in_window[i], i,
window.selected_tab_index == (int)i)); window.selected_tab_index == (int)i));
...@@ -265,29 +266,29 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( ...@@ -265,29 +266,29 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
std::string session_id = std::string session_id =
SessionId(session_tag, window.window_id.id()).ToString(); SessionId(session_tag, window.window_id.id()).ToString();
windows::WindowType type = windows::WINDOW_TYPE_NONE; api::windows::WindowType type = api::windows::WINDOW_TYPE_NONE;
switch (window.type) { switch (window.type) {
case sessions::SessionWindow::TYPE_TABBED: case sessions::SessionWindow::TYPE_TABBED:
type = windows::WINDOW_TYPE_NORMAL; type = api::windows::WINDOW_TYPE_NORMAL;
break; break;
case sessions::SessionWindow::TYPE_POPUP: case sessions::SessionWindow::TYPE_POPUP:
type = windows::WINDOW_TYPE_POPUP; type = api::windows::WINDOW_TYPE_POPUP;
break; break;
} }
windows::WindowState state = windows::WINDOW_STATE_NONE; api::windows::WindowState state = api::windows::WINDOW_STATE_NONE;
switch (window.show_state) { switch (window.show_state) {
case ui::SHOW_STATE_NORMAL: case ui::SHOW_STATE_NORMAL:
state = windows::WINDOW_STATE_NORMAL; state = api::windows::WINDOW_STATE_NORMAL;
break; break;
case ui::SHOW_STATE_MINIMIZED: case ui::SHOW_STATE_MINIMIZED:
state = windows::WINDOW_STATE_MINIMIZED; state = api::windows::WINDOW_STATE_MINIMIZED;
break; break;
case ui::SHOW_STATE_MAXIMIZED: case ui::SHOW_STATE_MAXIMIZED:
state = windows::WINDOW_STATE_MAXIMIZED; state = api::windows::WINDOW_STATE_MAXIMIZED;
break; break;
case ui::SHOW_STATE_FULLSCREEN: case ui::SHOW_STATE_FULLSCREEN:
state = windows::WINDOW_STATE_FULLSCREEN; state = api::windows::WINDOW_STATE_FULLSCREEN;
break; break;
case ui::SHOW_STATE_DEFAULT: case ui::SHOW_STATE_DEFAULT:
case ui::SHOW_STATE_INACTIVE: case ui::SHOW_STATE_INACTIVE:
...@@ -295,7 +296,7 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( ...@@ -295,7 +296,7 @@ std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
break; break;
} }
std::unique_ptr<windows::Window> window_struct( std::unique_ptr<api::windows::Window> window_struct(
CreateWindowModelHelper(std::move(tabs), session_id, type, state)); CreateWindowModelHelper(std::move(tabs), session_id, type, state));
// TODO(dwankri): Dig deeper to resolve bounds not being optional, so closed // TODO(dwankri): Dig deeper to resolve bounds not being optional, so closed
// windows in GetRecentlyClosed can have set values in Window helper. // windows in GetRecentlyClosed can have set values in Window helper.
...@@ -311,14 +312,15 @@ std::unique_ptr<api::sessions::Session> ...@@ -311,14 +312,15 @@ std::unique_ptr<api::sessions::Session>
SessionsGetDevicesFunction::CreateSessionModel( SessionsGetDevicesFunction::CreateSessionModel(
const sessions::SessionWindow& window, const sessions::SessionWindow& window,
const std::string& session_tag) { const std::string& session_tag) {
std::unique_ptr<windows::Window> window_model( std::unique_ptr<api::windows::Window> window_model(
CreateWindowModel(window, session_tag)); CreateWindowModel(window, session_tag));
// There is a chance that after pruning uninteresting tabs the window will be // There is a chance that after pruning uninteresting tabs the window will be
// empty. // empty.
return !window_model ? std::unique_ptr<api::sessions::Session>() return !window_model
: CreateSessionModelHelper(window.timestamp.ToTimeT(), ? nullptr
std::unique_ptr<tabs::Tab>(), : CreateSessionModelHelper(window.timestamp.ToTimeT(),
std::move(window_model)); std::unique_ptr<api::tabs::Tab>(),
std::move(window_model));
} }
api::sessions::Device SessionsGetDevicesFunction::CreateDeviceModel( api::sessions::Device SessionsGetDevicesFunction::CreateDeviceModel(
...@@ -383,11 +385,11 @@ ExtensionFunction::ResponseAction SessionsGetDevicesFunction::Run() { ...@@ -383,11 +385,11 @@ ExtensionFunction::ResponseAction SessionsGetDevicesFunction::Run() {
ExtensionFunction::ResponseValue SessionsRestoreFunction::GetRestoredTabResult( ExtensionFunction::ResponseValue SessionsRestoreFunction::GetRestoredTabResult(
content::WebContents* contents) { content::WebContents* contents) {
std::unique_ptr<tabs::Tab> tab(ExtensionTabUtil::CreateTabObject( std::unique_ptr<api::tabs::Tab> tab(ExtensionTabUtil::CreateTabObject(
contents, ExtensionTabUtil::kScrubTab, extension())); contents, ExtensionTabUtil::kScrubTab, extension()));
std::unique_ptr<api::sessions::Session> restored_session( std::unique_ptr<api::sessions::Session> restored_session(
CreateSessionModelHelper(base::Time::Now().ToTimeT(), std::move(tab), CreateSessionModelHelper(base::Time::Now().ToTimeT(), std::move(tab),
std::unique_ptr<windows::Window>())); std::unique_ptr<api::windows::Window>()));
return ArgumentList(Restore::Results::Create(*restored_session)); return ArgumentList(Restore::Results::Create(*restored_session));
} }
...@@ -402,10 +404,10 @@ SessionsRestoreFunction::GetRestoredWindowResult(int window_id) { ...@@ -402,10 +404,10 @@ SessionsRestoreFunction::GetRestoredWindowResult(int window_id) {
std::unique_ptr<base::DictionaryValue> window_value( std::unique_ptr<base::DictionaryValue> window_value(
ExtensionTabUtil::CreateWindowValueForExtension( ExtensionTabUtil::CreateWindowValueForExtension(
*browser, extension(), ExtensionTabUtil::kPopulateTabs)); *browser, extension(), ExtensionTabUtil::kPopulateTabs));
std::unique_ptr<windows::Window> window( std::unique_ptr<api::windows::Window> window(
windows::Window::FromValue(*window_value)); api::windows::Window::FromValue(*window_value));
return ArgumentList(Restore::Results::Create(*CreateSessionModelHelper( return ArgumentList(Restore::Results::Create(*CreateSessionModelHelper(
base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(), base::Time::Now().ToTimeT(), std::unique_ptr<api::tabs::Tab>(),
std::move(window)))); std::move(window))));
} }
......
...@@ -35,8 +35,6 @@ using zoom::ZoomController; ...@@ -35,8 +35,6 @@ using zoom::ZoomController;
namespace extensions { namespace extensions {
namespace tabs = api::tabs;
namespace { namespace {
bool WillDispatchTabUpdatedEvent( bool WillDispatchTabUpdatedEvent(
...@@ -211,7 +209,7 @@ void TabsEventRouter::TabCreatedAt(WebContents* contents, ...@@ -211,7 +209,7 @@ void TabsEventRouter::TabCreatedAt(WebContents* contents,
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
std::unique_ptr<base::ListValue> args(new base::ListValue); std::unique_ptr<base::ListValue> args(new base::ListValue);
auto event = std::make_unique<Event>(events::TABS_ON_CREATED, auto event = std::make_unique<Event>(events::TABS_ON_CREATED,
tabs::OnCreated::kEventName, api::tabs::OnCreated::kEventName,
std::move(args), profile); std::move(args), profile);
event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
event->will_dispatch_callback = event->will_dispatch_callback =
...@@ -249,8 +247,9 @@ void TabsEventRouter::TabInsertedAt(TabStripModel* tab_strip_model, ...@@ -249,8 +247,9 @@ void TabsEventRouter::TabInsertedAt(TabStripModel* tab_strip_model,
args->Append(std::move(object_args)); args->Append(std::move(object_args));
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
DispatchEvent(profile, events::TABS_ON_ATTACHED, tabs::OnAttached::kEventName, DispatchEvent(profile, events::TABS_ON_ATTACHED,
std::move(args), EventRouter::USER_GESTURE_UNKNOWN); api::tabs::OnAttached::kEventName, std::move(args),
EventRouter::USER_GESTURE_UNKNOWN);
} }
void TabsEventRouter::TabDetachedAt(WebContents* contents, void TabsEventRouter::TabDetachedAt(WebContents* contents,
...@@ -274,8 +273,9 @@ void TabsEventRouter::TabDetachedAt(WebContents* contents, ...@@ -274,8 +273,9 @@ void TabsEventRouter::TabDetachedAt(WebContents* contents,
args->Append(std::move(object_args)); args->Append(std::move(object_args));
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
DispatchEvent(profile, events::TABS_ON_DETACHED, tabs::OnDetached::kEventName, DispatchEvent(profile, events::TABS_ON_DETACHED,
std::move(args), EventRouter::USER_GESTURE_UNKNOWN); api::tabs::OnDetached::kEventName, std::move(args),
EventRouter::USER_GESTURE_UNKNOWN);
} }
void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model, void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model,
...@@ -295,8 +295,9 @@ void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model, ...@@ -295,8 +295,9 @@ void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model,
args->Append(std::move(object_args)); args->Append(std::move(object_args));
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
DispatchEvent(profile, events::TABS_ON_REMOVED, tabs::OnRemoved::kEventName, DispatchEvent(profile, events::TABS_ON_REMOVED,
std::move(args), EventRouter::USER_GESTURE_UNKNOWN); api::tabs::OnRemoved::kEventName, std::move(args),
EventRouter::USER_GESTURE_UNKNOWN);
UnregisterForTabNotifications(contents); UnregisterForTabNotifications(contents);
} }
...@@ -324,18 +325,19 @@ void TabsEventRouter::ActiveTabChanged(WebContents* old_contents, ...@@ -324,18 +325,19 @@ void TabsEventRouter::ActiveTabChanged(WebContents* old_contents,
? EventRouter::USER_GESTURE_ENABLED ? EventRouter::USER_GESTURE_ENABLED
: EventRouter::USER_GESTURE_NOT_ENABLED; : EventRouter::USER_GESTURE_NOT_ENABLED;
DispatchEvent(profile, events::TABS_ON_SELECTION_CHANGED, DispatchEvent(profile, events::TABS_ON_SELECTION_CHANGED,
tabs::OnSelectionChanged::kEventName, args->CreateDeepCopy(), api::tabs::OnSelectionChanged::kEventName,
gesture); args->CreateDeepCopy(), gesture);
DispatchEvent(profile, events::TABS_ON_ACTIVE_CHANGED, DispatchEvent(profile, events::TABS_ON_ACTIVE_CHANGED,
tabs::OnActiveChanged::kEventName, std::move(args), gesture); api::tabs::OnActiveChanged::kEventName, std::move(args),
gesture);
// The onActivated event takes one argument: {windowId, tabId}. // The onActivated event takes one argument: {windowId, tabId}.
auto on_activated_args = std::make_unique<base::ListValue>(); auto on_activated_args = std::make_unique<base::ListValue>();
object_args->Set(tabs_constants::kTabIdKey, std::make_unique<Value>(tab_id)); object_args->Set(tabs_constants::kTabIdKey, std::make_unique<Value>(tab_id));
on_activated_args->Append(std::move(object_args)); on_activated_args->Append(std::move(object_args));
DispatchEvent(profile, events::TABS_ON_ACTIVATED, DispatchEvent(profile, events::TABS_ON_ACTIVATED,
tabs::OnActivated::kEventName, std::move(on_activated_args), api::tabs::OnActivated::kEventName,
gesture); std::move(on_activated_args), gesture);
} }
void TabsEventRouter::TabSelectionChanged( void TabsEventRouter::TabSelectionChanged(
...@@ -368,11 +370,11 @@ void TabsEventRouter::TabSelectionChanged( ...@@ -368,11 +370,11 @@ void TabsEventRouter::TabSelectionChanged(
// The onHighlighted event replaced onHighlightChanged. // The onHighlighted event replaced onHighlightChanged.
Profile* profile = tab_strip_model->profile(); Profile* profile = tab_strip_model->profile();
DispatchEvent(profile, events::TABS_ON_HIGHLIGHT_CHANGED, DispatchEvent(profile, events::TABS_ON_HIGHLIGHT_CHANGED,
tabs::OnHighlightChanged::kEventName, api::tabs::OnHighlightChanged::kEventName,
std::unique_ptr<base::ListValue>(args->DeepCopy()), std::unique_ptr<base::ListValue>(args->DeepCopy()),
EventRouter::USER_GESTURE_UNKNOWN); EventRouter::USER_GESTURE_UNKNOWN);
DispatchEvent(profile, events::TABS_ON_HIGHLIGHTED, DispatchEvent(profile, events::TABS_ON_HIGHLIGHTED,
tabs::OnHighlighted::kEventName, std::move(args), api::tabs::OnHighlighted::kEventName, std::move(args),
EventRouter::USER_GESTURE_UNKNOWN); EventRouter::USER_GESTURE_UNKNOWN);
} }
...@@ -394,7 +396,7 @@ void TabsEventRouter::TabMoved(WebContents* contents, ...@@ -394,7 +396,7 @@ void TabsEventRouter::TabMoved(WebContents* contents,
args->Append(std::move(object_args)); args->Append(std::move(object_args));
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
DispatchEvent(profile, events::TABS_ON_MOVED, tabs::OnMoved::kEventName, DispatchEvent(profile, events::TABS_ON_MOVED, api::tabs::OnMoved::kEventName,
std::move(args), EventRouter::USER_GESTURE_UNKNOWN); std::move(args), EventRouter::USER_GESTURE_UNKNOWN);
} }
...@@ -465,7 +467,7 @@ void TabsEventRouter::DispatchTabUpdatedEvent( ...@@ -465,7 +467,7 @@ void TabsEventRouter::DispatchTabUpdatedEvent(
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
auto event = std::make_unique<Event>(events::TABS_ON_UPDATED, auto event = std::make_unique<Event>(events::TABS_ON_UPDATED,
tabs::OnUpdated::kEventName, api::tabs::OnUpdated::kEventName,
std::move(args_base), profile); std::move(args_base), profile);
event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
event->will_dispatch_callback = event->will_dispatch_callback =
...@@ -503,7 +505,7 @@ void TabsEventRouter::TabReplacedAt(TabStripModel* tab_strip_model, ...@@ -503,7 +505,7 @@ void TabsEventRouter::TabReplacedAt(TabStripModel* tab_strip_model,
args->AppendInteger(old_tab_id); args->AppendInteger(old_tab_id);
DispatchEvent(Profile::FromBrowserContext(new_contents->GetBrowserContext()), DispatchEvent(Profile::FromBrowserContext(new_contents->GetBrowserContext()),
events::TABS_ON_REPLACED, tabs::OnReplaced::kEventName, events::TABS_ON_REPLACED, api::tabs::OnReplaced::kEventName,
std::move(args), EventRouter::USER_GESTURE_UNKNOWN); std::move(args), EventRouter::USER_GESTURE_UNKNOWN);
UnregisterForTabNotifications(old_contents); UnregisterForTabNotifications(old_contents);
...@@ -541,7 +543,7 @@ void TabsEventRouter::OnZoomChanged( ...@@ -541,7 +543,7 @@ void TabsEventRouter::OnZoomChanged(
Profile* profile = Profile::FromBrowserContext( Profile* profile = Profile::FromBrowserContext(
data.web_contents->GetBrowserContext()); data.web_contents->GetBrowserContext());
DispatchEvent(profile, events::TABS_ON_ZOOM_CHANGE, DispatchEvent(profile, events::TABS_ON_ZOOM_CHANGE,
tabs::OnZoomChange::kEventName, api::tabs::OnZoomChange::kEventName,
api::tabs::OnZoomChange::Create(zoom_change_info), api::tabs::OnZoomChange::Create(zoom_change_info),
EventRouter::USER_GESTURE_UNKNOWN); EventRouter::USER_GESTURE_UNKNOWN);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment