OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 *success = true; | 1301 *success = true; |
1302 } | 1302 } |
1303 } | 1303 } |
1304 | 1304 |
1305 void TestingAutomationProvider::GetShelfVisibility(int handle, bool* visible) { | 1305 void TestingAutomationProvider::GetShelfVisibility(int handle, bool* visible) { |
1306 *visible = false; | 1306 *visible = false; |
1307 | 1307 |
1308 if (browser_tracker_->ContainsHandle(handle)) { | 1308 if (browser_tracker_->ContainsHandle(handle)) { |
1309 Browser* browser = browser_tracker_->GetResource(handle); | 1309 Browser* browser = browser_tracker_->GetResource(handle); |
1310 if (browser) { | 1310 if (browser) { |
1311 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 1311 #if defined(OS_CHROMEOS) |
1312 *visible = ActiveDownloadsUI::GetPopup(NULL); | |
1313 #elif defined(OS_CHROMEOS) | |
1314 *visible = ActiveDownloadsUI::GetPopup(); | 1312 *visible = ActiveDownloadsUI::GetPopup(); |
1315 #else | 1313 #else |
1316 *visible = browser->window()->IsDownloadShelfVisible(); | 1314 *visible = browser->window()->IsDownloadShelfVisible(); |
1317 #endif | 1315 #endif |
1318 } | 1316 } |
1319 } | 1317 } |
1320 } | 1318 } |
1321 | 1319 |
1322 void TestingAutomationProvider::IsFullscreen(int handle, bool* visible) { | 1320 void TestingAutomationProvider::IsFullscreen(int handle, bool* visible) { |
1323 *visible = false; | 1321 *visible = false; |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 | 2176 |
2179 void TestingAutomationProvider::SavePackageShouldPromptUser( | 2177 void TestingAutomationProvider::SavePackageShouldPromptUser( |
2180 bool should_prompt) { | 2178 bool should_prompt) { |
2181 SavePackageFilePicker::SetShouldPromptUser(should_prompt); | 2179 SavePackageFilePicker::SetShouldPromptUser(should_prompt); |
2182 } | 2180 } |
2183 | 2181 |
2184 void TestingAutomationProvider::SetShelfVisibility(int handle, bool visible) { | 2182 void TestingAutomationProvider::SetShelfVisibility(int handle, bool visible) { |
2185 if (browser_tracker_->ContainsHandle(handle)) { | 2183 if (browser_tracker_->ContainsHandle(handle)) { |
2186 Browser* browser = browser_tracker_->GetResource(handle); | 2184 Browser* browser = browser_tracker_->GetResource(handle); |
2187 if (browser) { | 2185 if (browser) { |
2188 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 2186 #if defined(OS_CHROMEOS) |
2189 Browser* browser_download = NULL; | |
2190 TabContents* download_contents = | |
2191 ActiveDownloadsUI::GetPopup(&browser_download); | |
2192 if (!download_contents && visible) | |
2193 ActiveDownloadsUI::OpenPopup(browser_download->profile()); | |
2194 if (download_contents && !visible) | |
2195 browser_download->CloseTabContents(download_contents); | |
2196 #elif defined(OS_CHROMEOS) | |
2197 Browser* popup_browser = ActiveDownloadsUI::GetPopup(); | 2187 Browser* popup_browser = ActiveDownloadsUI::GetPopup(); |
2198 if (!popup_browser && visible) | 2188 if (!popup_browser && visible) |
2199 ActiveDownloadsUI::OpenPopup(browser->profile()); | 2189 ActiveDownloadsUI::OpenPopup(browser->profile()); |
2200 if (popup_browser && !visible) | 2190 if (popup_browser && !visible) |
2201 popup_browser->CloseWindow(); | 2191 popup_browser->CloseWindow(); |
2202 #else | 2192 #else |
2203 if (visible) | 2193 if (visible) |
2204 browser->window()->GetDownloadShelf()->Show(); | 2194 browser->window()->GetDownloadShelf()->Show(); |
2205 else | 2195 else |
2206 browser->window()->GetDownloadShelf()->Close(); | 2196 browser->window()->GetDownloadShelf()->Close(); |
(...skipping 4181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6388 | 6378 |
6389 Send(reply_message_); | 6379 Send(reply_message_); |
6390 redirect_query_ = 0; | 6380 redirect_query_ = 0; |
6391 reply_message_ = NULL; | 6381 reply_message_ = NULL; |
6392 } | 6382 } |
6393 | 6383 |
6394 void TestingAutomationProvider::OnRemoveProvider() { | 6384 void TestingAutomationProvider::OnRemoveProvider() { |
6395 if (g_browser_process) | 6385 if (g_browser_process) |
6396 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6386 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6397 } | 6387 } |
OLD | NEW |