| 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/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "content/public/browser/notification_source.h" | 53 #include "content/public/browser/notification_source.h" |
| 54 #include "skia/ext/image_operations.h" | 54 #include "skia/ext/image_operations.h" |
| 55 #include "skia/ext/platform_canvas.h" | 55 #include "skia/ext/platform_canvas.h" |
| 56 #include "third_party/skia/include/core/SkBitmap.h" | 56 #include "third_party/skia/include/core/SkBitmap.h" |
| 57 #include "ui/gfx/codec/jpeg_codec.h" | 57 #include "ui/gfx/codec/jpeg_codec.h" |
| 58 #include "ui/gfx/codec/png_codec.h" | 58 #include "ui/gfx/codec/png_codec.h" |
| 59 | 59 |
| 60 namespace keys = extension_tabs_module_constants; | 60 namespace keys = extension_tabs_module_constants; |
| 61 namespace errors = extension_manifest_errors; | 61 namespace errors = extension_manifest_errors; |
| 62 | 62 |
| 63 using content::NavigationEntry; |
| 63 using content::OpenURLParams; | 64 using content::OpenURLParams; |
| 64 using content::Referrer; | 65 using content::Referrer; |
| 65 using content::WebContents; | 66 using content::WebContents; |
| 66 | 67 |
| 67 const int CaptureVisibleTabFunction::kDefaultQuality = 90; | 68 const int CaptureVisibleTabFunction::kDefaultQuality = 90; |
| 68 | 69 |
| 69 namespace { | 70 namespace { |
| 70 | 71 |
| 71 // |error_message| can optionally be passed in a will be set with an appropriate | 72 // |error_message| can optionally be passed in a will be set with an appropriate |
| 72 // message if the window cannot be found by id. | 73 // message if the window cannot be found by id. |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 | 1371 |
| 1371 Browser* browser = NULL; | 1372 Browser* browser = NULL; |
| 1372 if (!GetTabById(tab_id, profile(), include_incognito(), | 1373 if (!GetTabById(tab_id, profile(), include_incognito(), |
| 1373 &browser, NULL, &contents, NULL, &error_)) | 1374 &browser, NULL, &contents, NULL, &error_)) |
| 1374 return false; | 1375 return false; |
| 1375 } | 1376 } |
| 1376 | 1377 |
| 1377 TabContents* tab_contents = contents->tab_contents(); | 1378 TabContents* tab_contents = contents->tab_contents(); |
| 1378 if (tab_contents->ShowingInterstitialPage()) { | 1379 if (tab_contents->ShowingInterstitialPage()) { |
| 1379 // This does as same as Browser::ReloadInternal. | 1380 // This does as same as Browser::ReloadInternal. |
| 1380 content::NavigationEntry* entry = | 1381 NavigationEntry* entry = tab_contents->GetController().GetActiveEntry(); |
| 1381 tab_contents->GetController().GetActiveEntry(); | |
| 1382 OpenURLParams params(entry->GetURL(), Referrer(), CURRENT_TAB, | 1382 OpenURLParams params(entry->GetURL(), Referrer(), CURRENT_TAB, |
| 1383 content::PAGE_TRANSITION_RELOAD, false); | 1383 content::PAGE_TRANSITION_RELOAD, false); |
| 1384 GetCurrentBrowser()->OpenURL(params); | 1384 GetCurrentBrowser()->OpenURL(params); |
| 1385 } else if (bypass_cache) { | 1385 } else if (bypass_cache) { |
| 1386 tab_contents->GetController().ReloadIgnoringCache(true); | 1386 tab_contents->GetController().ReloadIgnoringCache(true); |
| 1387 } else { | 1387 } else { |
| 1388 tab_contents->GetController().Reload(true); | 1388 tab_contents->GetController().Reload(true); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 return true; | 1391 return true; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 // called for every API call the extension made. | 1660 // called for every API call the extension made. |
| 1661 GotLanguage(language); | 1661 GotLanguage(language); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1664 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1665 result_.reset(Value::CreateStringValue(language.c_str())); | 1665 result_.reset(Value::CreateStringValue(language.c_str())); |
| 1666 SendResponse(true); | 1666 SendResponse(true); |
| 1667 | 1667 |
| 1668 Release(); // Balanced in Run() | 1668 Release(); // Balanced in Run() |
| 1669 } | 1669 } |
| OLD | NEW |