| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 if (!contents) { | 367 if (!contents) { |
| 368 error_ = ExtensionErrorUtils::FormatErrorMessage( | 368 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 369 keys::kTabNotFoundError, base::IntToString(tab_id)); | 369 keys::kTabNotFoundError, base::IntToString(tab_id)); |
| 370 return false; | 370 return false; |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 // Try to position the new browser relative its originating browser window. | 375 // Try to position the new browser relative its originating browser window. |
| 376 gfx::Rect window_bounds; | 376 gfx::Rect window_bounds; |
| 377 bool maximized; | |
| 378 // The call offsets the bounds by kWindowTilePixels (defined in WindowSizer to | 377 // The call offsets the bounds by kWindowTilePixels (defined in WindowSizer to |
| 379 // be 10) | 378 // be 10) |
| 380 // | 379 // |
| 381 // NOTE(rafaelw): It's ok if GetCurrentBrowser() returns NULL here. | 380 // NOTE(rafaelw): It's ok if GetCurrentBrowser() returns NULL here. |
| 382 // GetBrowserWindowBounds will default to saved "default" values for the app. | 381 // GetBrowserWindowBounds will default to saved "default" values for the app. |
| 383 WindowSizer::GetBrowserWindowBounds(std::string(), gfx::Rect(), | 382 WindowSizer::GetBrowserWindowBounds(std::string(), gfx::Rect(), |
| 384 GetCurrentBrowser(), &window_bounds, | 383 GetCurrentBrowser(), &window_bounds); |
| 385 &maximized); | |
| 386 | 384 |
| 387 // Calculate popup and panels bounds separately. | 385 // Calculate popup and panels bounds separately. |
| 388 gfx::Rect popup_bounds; | 386 gfx::Rect popup_bounds; |
| 389 gfx::Rect panel_bounds; // Use 0x0 for panels. Panel manager sizes them. | 387 gfx::Rect panel_bounds; // Use 0x0 for panels. Panel manager sizes them. |
| 390 | 388 |
| 391 // In ChromiumOS the default popup bounds is 0x0 which indicates default | 389 // In ChromiumOS the default popup bounds is 0x0 which indicates default |
| 392 // window sizes in PanelBrowserView. In other OSs use the same default | 390 // window sizes in PanelBrowserView. In other OSs use the same default |
| 393 // bounds as windows. | 391 // bounds as windows. |
| 394 #if defined(OS_CHROMEOS) | 392 #if defined(OS_CHROMEOS) |
| 395 popup_bounds = panel_bounds; | 393 popup_bounds = panel_bounds; |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 // called for every API call the extension made. | 1567 // called for every API call the extension made. |
| 1570 GotLanguage(language); | 1568 GotLanguage(language); |
| 1571 } | 1569 } |
| 1572 | 1570 |
| 1573 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1571 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1574 result_.reset(Value::CreateStringValue(language.c_str())); | 1572 result_.reset(Value::CreateStringValue(language.c_str())); |
| 1575 SendResponse(true); | 1573 SendResponse(true); |
| 1576 | 1574 |
| 1577 Release(); // Balanced in Run() | 1575 Release(); // Balanced in Run() |
| 1578 } | 1576 } |
| OLD | NEW |