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/webui/feedback_ui.h" | 5 #include "chrome/browser/ui/webui/feedback_ui.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 &query_str, 0, kTimestampParameter, ""); | 379 &query_str, 0, kTimestampParameter, ""); |
380 timestamp_ = query_str; | 380 timestamp_ = query_str; |
381 continue; | 381 continue; |
382 } | 382 } |
383 #endif | 383 #endif |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 // If we don't have a page url specified, get it from the tab index. | 387 // If we don't have a page url specified, get it from the tab index. |
388 if (custom_page_url.empty()) { | 388 if (custom_page_url.empty()) { |
389 if (session_id == -1 || index == -1) | 389 if (session_id == -1) |
390 return false; | 390 return false; |
391 | 391 |
392 #if !defined(OS_CHROMEOS) | |
rkc1
2012/07/09 18:23:22
We set the index in ShowFeedbackView for all platf
Jun Mukai
2012/07/10 11:08:20
That's browser->active_index() in line 178, right?
rkc1
2012/07/10 17:20:10
Yes, let's remove it for all platforms. There are
Jun Mukai
2012/07/11 12:42:39
Sure, then removed the check itself. now index==-
| |
393 if (index == -1) | |
394 return false; | |
395 #endif | |
396 | |
392 Browser* browser = browser::FindBrowserWithID(session_id); | 397 Browser* browser = browser::FindBrowserWithID(session_id); |
393 // Sanity checks. | 398 // Sanity checks. |
394 if (!browser || index >= browser->tab_count()) | 399 if (!browser || index >= browser->tab_count()) |
395 return false; | 400 return false; |
396 | 401 |
397 WebContents* target_tab = chrome::GetWebContentsAt(browser, index); | 402 if (index >= 0) { |
398 if (target_tab) | 403 WebContents* target_tab = chrome::GetWebContentsAt(browser, index); |
399 target_tab_url_ = target_tab->GetURL().spec(); | 404 if (target_tab) |
405 target_tab_url_ = target_tab->GetURL().spec(); | |
406 } | |
400 | 407 |
401 // Note: We don't need to setup a screenshot source if we're using a | 408 // Note: We don't need to setup a screenshot source if we're using a |
402 // custom page URL since we were invoked from JS/an extension, in which | 409 // custom page URL since we were invoked from JS/an extension, in which |
403 // case we don't actually have a screenshot anyway. | 410 // case we don't actually have a screenshot anyway. |
404 SetupScreenshotsSource(); | 411 SetupScreenshotsSource(); |
405 } else { | 412 } else { |
406 target_tab_url_ = custom_page_url; | 413 target_tab_url_ = custom_page_url; |
407 } | 414 } |
408 | 415 |
409 return true; | 416 return true; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 652 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
646 std::partial_sort(screenshot_filepaths.begin(), | 653 std::partial_sort(screenshot_filepaths.begin(), |
647 screenshot_filepaths.begin() + sort_size, | 654 screenshot_filepaths.begin() + sort_size, |
648 screenshot_filepaths.end(), | 655 screenshot_filepaths.end(), |
649 ScreenshotTimestampComp); | 656 ScreenshotTimestampComp); |
650 for (size_t i = 0; i < sort_size; ++i) | 657 for (size_t i = 0; i < sort_size; ++i) |
651 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 658 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
652 screenshot_filepaths[i]); | 659 screenshot_filepaths[i]); |
653 } | 660 } |
654 #endif | 661 #endif |
OLD | NEW |