| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/search/other_device_menu_controller.h" | 5 #include "chrome/browser/ui/search/other_device_menu_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "chrome/browser/sync/glue/session_model_associator.h" | 9 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // This is not a mistake - sessionId actually refers to the tab id. | 130 // This is not a mistake - sessionId actually refers to the tab id. |
| 131 // See http://crbug.com/154865. | 131 // See http://crbug.com/154865. |
| 132 int tab_id = browser_sync::ForeignSessionHandler::kInvalidId; | 132 int tab_id = browser_sync::ForeignSessionHandler::kInvalidId; |
| 133 tab_data->GetInteger("sessionId", &tab_id); | 133 tab_data->GetInteger("sessionId", &tab_id); |
| 134 | 134 |
| 135 int window_id = browser_sync::ForeignSessionHandler::kInvalidId; | 135 int window_id = browser_sync::ForeignSessionHandler::kInvalidId; |
| 136 tab_data->GetInteger("windowId", &window_id); | 136 tab_data->GetInteger("windowId", &window_id); |
| 137 | 137 |
| 138 if (tab_id != browser_sync::ForeignSessionHandler::kInvalidId) { | 138 if (tab_id != browser_sync::ForeignSessionHandler::kInvalidId) { |
| 139 WindowOpenDisposition disposition = | 139 WindowOpenDisposition disposition = |
| 140 chrome::DispositionFromEventFlags(event_flags); | 140 ui::DispositionFromEventFlags(event_flags); |
| 141 browser_sync::ForeignSessionHandler::OpenForeignSessionTab( | 141 browser_sync::ForeignSessionHandler::OpenForeignSessionTab( |
| 142 web_ui_, session_id_, window_id, tab_id, disposition); | 142 web_ui_, session_id_, window_id, tab_id, disposition); |
| 143 } else { | 143 } else { |
| 144 browser_sync::ForeignSessionHandler::OpenForeignSessionWindows( | 144 browser_sync::ForeignSessionHandler::OpenForeignSessionWindows( |
| 145 web_ui_, session_id_, window_id); | 145 web_ui_, session_id_, window_id); |
| 146 } | 146 } |
| 147 ItemType itemType = tab_id == | 147 ItemType itemType = tab_id == |
| 148 browser_sync::ForeignSessionHandler::kInvalidId ? OPEN_ALL : TAB; | 148 browser_sync::ForeignSessionHandler::kInvalidId ? OPEN_ALL : TAB; |
| 149 UMA_HISTOGRAM_ENUMERATION("NewTabPage.OtherDeviceMenu", | 149 UMA_HISTOGRAM_ENUMERATION("NewTabPage.OtherDeviceMenu", |
| 150 itemType, ITEM_TYPE_ENUM_COUNT); | 150 itemType, ITEM_TYPE_ENUM_COUNT); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 if (tab_data_.size() >= kMaxTabsToShow) | 193 if (tab_data_.size() >= kMaxTabsToShow) |
| 194 return; | 194 return; |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 // OtherDevice menu ---------------------------------------------------------- | 200 // OtherDevice menu ---------------------------------------------------------- |
| 201 | 201 |
| 202 OtherDeviceMenu::~OtherDeviceMenu() {} | 202 OtherDeviceMenu::~OtherDeviceMenu() {} |
| OLD | NEW |